fix: 增加上传处理

This commit is contained in:
dhb52 2023-04-15 16:54:36 +08:00
parent 97f9560c4d
commit ae74af59fc
2 changed files with 4 additions and 2 deletions

View File

@ -7,6 +7,7 @@
:file-list="fileList"
:data="uploadData"
:on-progress="() => (uploading = true)"
:on-error="(err: Error) => message.error(`上传失败: ${err.message}`)"
:before-upload="beforeUpload"
:on-success="handleUploadSuccess"
>
@ -33,7 +34,7 @@ import {
const message = useMessage()
const props = defineProps<{ type: boolean }>()
const props = defineProps<{ type: MaterialType }>()
const fileList = ref<UploadUserFile[]>([])
const emit = defineEmits<{
@ -47,7 +48,7 @@ const uploadData: UploadData = reactive({
})
const uploading = ref(false)
const beforeUpload = props.type == MaterialType.Image ? beforeImageUpload : beforeVoiceUpload
const beforeUpload = props.type === MaterialType.Image ? beforeImageUpload : beforeVoiceUpload
const handleUploadSuccess: UploadProps['onSuccess'] = (res: any) => {
if (res.code !== 0) {

View File

@ -9,6 +9,7 @@
:data="uploadData"
:before-upload="beforeVideoUpload"
:on-progress="() => (uploading = true)"
:on-error="(err: Error) => message.error(`上传失败: ${err.message}`)"
:on-success="handleUploadSuccess"
ref="uploadVideoRef"
:auto-upload="false"