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:
parent
85ac005570
commit
cffcddefb9
9 changed files with 177 additions and 138 deletions
components/common
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue