fix: enable nav commands only once

This commit is contained in:
三咲智子 2022-12-30 03:31:29 +08:00
parent 524f7005aa
commit 1054e556e8
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
4 changed files with 26 additions and 20 deletions

View file

@ -8,18 +8,17 @@ const props = defineProps<{
const router = useRouter()
if (props.command) {
useCommand({
scope: 'Settings',
useCommand({
scope: 'Settings',
name: () => props.text ?? (typeof props.to === 'string' ? props.to as string : props.to.name),
icon: () => props.icon || '',
name: () => props.text ?? (typeof props.to === 'string' ? props.to as string : props.to.name),
icon: () => props.icon || '',
visible: () => props.command,
onActivate() {
router.push(props.to)
},
})
}
onActivate() {
router.push(props.to)
},
})
</script>
<template>