fix(editor): 从页面切换成页面片时不会默认选中第一个页面片

This commit is contained in:
roymondchen 2024-02-28 16:38:32 +08:00
parent b4df7f5eea
commit 3fe83f9fa4

View File

@ -123,7 +123,7 @@ watch(
watch(active, (active) => {
if (active === NodeType.PAGE) {
if (!activePage.value) {
if (!activePage.value && !pageList.value.length) {
editorService?.selectRoot();
return;
}
@ -132,11 +132,12 @@ watch(active, (active) => {
}
if (active === NodeType.PAGE_FRAGMENT) {
if (!activePageFragment.value) {
//
if (!activePageFragment.value && !pageFragmentList.value.length) {
editorService?.selectRoot();
return;
}
switchPage(activePageFragment.value);
switchPage(activePageFragment.value || pageFragmentList.value[0].id);
}
});