perf: 上传组件添加accept属性

This commit is contained in:
can 2025-03-05 11:25:39 +08:00
parent ace672dd0c
commit bdaddb4bf6
2 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,7 @@
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:file-list="fileList" :file-list="fileList"
:limit="limit" :limit="limit"
:accept="fileAccept"
:on-error="handleUploadError" :on-error="handleUploadError"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-success="handleUploadSuccess" :on-success="handleUploadSuccess"
@ -79,6 +80,9 @@ const showTip = computed(() => props.isShowTip && (props.fileType || props.fileS
const fileUploadRef = ref<ElUploadInstance>(); const fileUploadRef = ref<ElUploadInstance>();
// fileType fileAccept
const fileAccept = computed(() => props.fileType.map((type) => `.${type}`).join(','));
watch( watch(
() => props.modelValue, () => props.modelValue,
async (val) => { async (val) => {

View File

@ -8,6 +8,7 @@
:on-success="handleUploadSuccess" :on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:limit="limit" :limit="limit"
:accept="fileAccept"
:on-error="handleUploadError" :on-error="handleUploadError"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:before-remove="handleDelete" :before-remove="handleDelete"
@ -87,6 +88,9 @@ const showTip = computed(() => props.isShowTip && (props.fileType || props.fileS
const imageUploadRef = ref<ElUploadInstance>(); const imageUploadRef = ref<ElUploadInstance>();
// fileType fileAccept
const fileAccept = computed(() => props.fileType.map((type) => `.${type}`).join(','));
watch( watch(
() => props.modelValue, () => props.modelValue,
async (val: string) => { async (val: string) => {