diff --git a/src/layout/GlobalMenu.tsx b/src/layout/GlobalMenu.tsx index 06c3113..024ca91 100644 --- a/src/layout/GlobalMenu.tsx +++ b/src/layout/GlobalMenu.tsx @@ -207,10 +207,16 @@ export default defineComponent(() => { alert onClick={() => { // 删除链接 - const idx = layout.currentPage.list.findIndex((el) => el.id === block.id) - if (idx < 0) return - layout.currentPage.list.splice(idx, 1) + console.log(menu.selectPage); + + const idx = layout.state.content[layout.state.current].pages.findIndex(el => el.id === menu.selectPage?.id) menu.dismiss() + + if (idx < 0) return + if (idx === layout.state.currentPage) { + return + } + layout.state.content[layout.state.current].pages.splice(idx, 1) }} > 删除 diff --git a/src/layout/sider/index.tsx b/src/layout/sider/index.tsx index d05346b..ffaa497 100644 --- a/src/layout/sider/index.tsx +++ b/src/layout/sider/index.tsx @@ -230,7 +230,14 @@ export default defineComponent(() => { if (menu.selectPage) { menu.selectPage.name = selected.value.name menu.selectPage.label = label.value - + if (!menu.selectPage?.id) return + const idx = layout.state.content[layout.state.current].pages.findIndex(val => val.id === menu.selectPage?.id) + if (idx !== -1) { + layout.state.content[layout.state.current].pages[idx].label = label.value + layout.state.content[layout.state.current].pages[idx].name = selected.value.name + + } + menu.selectPage = undefined } else { layout.currentMode.pages.push({ list: [],