1
0
Fork 0
mirror of https://github.com/elk-zone/elk.git synced 2025-05-07 15:55:20 +03:00

refactor: use defineModel

This commit is contained in:
三咲智子 2023-01-06 23:46:36 +08:00
parent 85ac005570
commit cffcddefb9
No known key found for this signature in database
GPG key ID: 69992F2250DFD93E
9 changed files with 177 additions and 138 deletions
components/common

View file

@ -3,7 +3,6 @@ import { fileOpen } from 'browser-fs-access'
import type { FileWithHandle } from 'browser-fs-access'
const props = withDefaults(defineProps<{
modelValue?: FileWithHandle | null
/** The image src before change */
original?: string
/** Allowed file types */
@ -19,12 +18,13 @@ const props = withDefaults(defineProps<{
allowedFileSize: 1024 * 1024 * 5, // 5 MB
})
const emit = defineEmits<{
(event: 'update:modelValue', value: FileWithHandle): void
(event: 'pick', value: FileWithHandle): void
(event: 'error', code: number, message: string): void
}>()
const file = useVModel(props, 'modelValue', emit, { passive: true })
const { modelValue: file } = defineModel<{
modelValue: FileWithHandle | null
}>()
const { t } = useI18n()