mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-02 12:59:47 +08:00
fix(editor): 从页面切换成页面片时不会默认选中第一个页面片
This commit is contained in:
parent
b4df7f5eea
commit
3fe83f9fa4
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user