refactor: remove withDefaults macro and clean up reactive props destructuring (#3217)

This commit is contained in:
TAKAHASHI Shuuji 2025-03-02 23:50:12 +09:00 committed by GitHub
parent 7d9712c209
commit 60b1d0224c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 177 additions and 232 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
const props = defineProps<{
const { text, description, icon, to, command, external, target } = defineProps<{
text?: string
content?: string
description?: string
@ -14,24 +14,24 @@ const props = defineProps<{
}>()
const router = useRouter()
const scrollOnClick = computed(() => props.to && !(props.target === '_blank' || props.external))
const scrollOnClick = computed(() => to && !(target === '_blank' || external))
useCommand({
scope: 'Settings',
name: () => props.text
?? (props.to
? typeof props.to === 'string'
? props.to
: props.to.name
name: () => text
?? (to
? typeof to === 'string'
? to
: to.name
: ''
),
description: () => props.description,
icon: () => props.icon || '',
visible: () => props.command && props.to,
description: () => description,
icon: () => icon || '',
visible: () => command && to,
onActivate() {
router.push(props.to!)
router.push(to!)
},
})
</script>