侧边栏缺少右键编辑功能

This commit is contained in:
expdsn 2024-11-15 13:51:59 +08:00
parent 3a07dae8b3
commit 6dc7b86370
2 changed files with 17 additions and 4 deletions

View File

@ -207,10 +207,16 @@ export default defineComponent(() => {
alert alert
onClick={() => { onClick={() => {
// 删除链接 // 删除链接
const idx = layout.currentPage.list.findIndex((el) => el.id === block.id) console.log(menu.selectPage);
if (idx < 0) return
layout.currentPage.list.splice(idx, 1) const idx = layout.state.content[layout.state.current].pages.findIndex(el => el.id === menu.selectPage?.id)
menu.dismiss() menu.dismiss()
if (idx < 0) return
if (idx === layout.state.currentPage) {
return
}
layout.state.content[layout.state.current].pages.splice(idx, 1)
}} }}
> >

View File

@ -230,7 +230,14 @@ export default defineComponent(() => {
if (menu.selectPage) { if (menu.selectPage) {
menu.selectPage.name = selected.value.name menu.selectPage.name = selected.value.name
menu.selectPage.label = label.value 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 { } else {
layout.currentMode.pages.push({ layout.currentMode.pages.push({
list: [], list: [],