From 6dc7b8637065b6783177338b335221448b28d556 Mon Sep 17 00:00:00 2001 From: expdsn <18111002318@163.com> Date: Fri, 15 Nov 2024 13:51:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E5=8F=B3=E9=94=AE=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/GlobalMenu.tsx | 12 +++++++++--- src/layout/sider/index.tsx | 9 ++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) 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: [],