Skip to content

Commit

Permalink
fix: 点击disabled菜单项 不关闭菜单
Browse files Browse the repository at this point in the history
  • Loading branch information
gargameljyh committed Nov 28, 2023
1 parent 4dc4a2d commit 94077c1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/canvas/src/components/container/CanvasMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ export default {
const boxVisibility = ref(false)
const actionDisabled = (actionItem) => {
const actions = ['del', 'copy', 'addParent']
return actions.includes(actionItem.code) && !getCurrent().schema?.id
}
const onShowChildrenMenu = (menuItem) => {
current.value = !actionDisabled(menuItem) ? menuItem : null
}
// 计算上下文菜单位置,右键时显示,否则关闭
const operations = {
Expand Down Expand Up @@ -167,11 +158,20 @@ export default {
}
}
const actionDisabled = (actionItem) => {
const actions = ['del', 'copy', 'addParent']
return actions.includes(actionItem.code) && !getCurrent().schema?.id
}
const onShowChildrenMenu = (menuItem) => {
current.value = !actionDisabled(menuItem) ? menuItem : null
}
const close = () => {
boxVisibility.value = false
}
const doOperation = (item) => {
if (item.check && !item.check?.()) {
if ((item.check && !item.check?.()) || actionDisabled(item)) {
return
}
Expand Down

0 comments on commit 94077c1

Please sign in to comment.