refactor: replace defineModels with defineModel

This commit is contained in:
三咲智子 Kevin Deng 2023-08-01 17:43:55 +08:00
parent e6172ad38b
commit d23f1d39eb
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
17 changed files with 35 additions and 56 deletions

View file

@ -2,9 +2,7 @@
const emit = defineEmits<{
(event: 'close'): void
}>()
const { modelValue: visible } = defineModels<{
modelValue?: boolean
}>()
const visible = defineModel<boolean>()
function close() {
emit('close')

View file

@ -5,9 +5,7 @@ defineProps<{
iconChecked?: string
iconUnchecked?: string
}>()
const { modelValue } = defineModels<{
modelValue?: boolean | null
}>()
const modelValue = defineModel<boolean | null>()
</script>
<template>

View file

@ -14,10 +14,7 @@ const props = withDefaults(defineProps<Props>(), {
stencilSizePercentage: 0.9,
})
const { modelValue: file } = defineModels<{
/** Images to be cropped */
modelValue: File | null
}>()
const file = defineModel<File | null>()
const cropperDialog = ref(false)

View file

@ -22,9 +22,7 @@ const emit = defineEmits<{
(event: 'error', code: number, message: string): void
}>()
const { modelValue: file } = defineModels<{
modelValue: FileWithHandle | null
}>()
const file = defineModel<FileWithHandle | null>()
const { t } = useI18n()

View file

@ -4,9 +4,7 @@ defineProps<{
value: any
hover?: boolean
}>()
const { modelValue } = defineModels<{
modelValue: any
}>()
const modelValue = defineModel()
</script>
<template>

View file

@ -8,9 +8,7 @@ const { options, command } = defineProps<{
command?: boolean
}>()
const { modelValue } = defineModels<{
modelValue: string
}>()
const modelValue = defineModel<string>({ required: true })
const tabs = $computed(() => {
return options.map((option) => {