diff --git a/packages/client/app/layout/layout.vue b/packages/client/app/layout/layout.vue index d50c798d..9bf6c361 100644 --- a/packages/client/app/layout/layout.vue +++ b/packages/client/app/layout/layout.vue @@ -16,13 +16,13 @@ diff --git a/packages/client/app/layout/menu-item.vue b/packages/client/app/layout/menu-item.vue index 9a1bcc59..15ac7fa8 100644 --- a/packages/client/app/layout/menu-item.vue +++ b/packages/client/app/layout/menu-item.vue @@ -1,7 +1,7 @@ @@ -11,17 +11,23 @@ import { LegacyMenuItem, MaybeGetter, useContext } from '@koishijs/client' import { computed } from 'vue' -const props = defineProps() const ctx = useContext() +const hidden = computed(() => { + if (!props.item.hidden) return false + return toValue(props.item.hidden) +}) + const disabled = computed(() => { - if (!props.action) return true - if (!props.disabled) return false - return toValue(props.disabled) + if (!props.item.action) return true + if (!props.item.disabled) return false + return toValue(props.item.disabled) }) function toValue(getter: MaybeGetter): T { @@ -30,7 +36,7 @@ function toValue(getter: MaybeGetter): T { } function trigger() { - return props.action(ctx.internal.createScope({ + return props.item.action(ctx.internal.createScope({ [props.menuKey]: props.menuData, })) } diff --git a/packages/client/app/theme/menu/index.vue b/packages/client/app/theme/menu/index.vue index fb91752d..84d344e9 100644 --- a/packages/client/app/theme/menu/index.vue +++ b/packages/client/app/theme/menu/index.vue @@ -1,5 +1,5 @@