上传文件新增加手动上传

This commit is contained in:
不做码农 2022-05-07 22:01:33 +08:00
parent 2f8ea816e8
commit f107be0ee5

View File

@ -13,6 +13,7 @@
:data="data"
:drag="drag"
:headers="headers"
:auto-upload="autoUpload"
class="upload-file-uploader"
ref="upload"
>
@ -100,7 +101,7 @@ const emit = defineEmits()
const number = ref(0)
const uploadList = ref([])
const baseUrl = import.meta.env.VITE_APP_BASE_API
const uploadFileUrl = ref(baseUrl + import.meta.env.VITE_APP_UPLOAD_URL ?? '/Common/UploadFile') //
const uploadFileUrl = ref(baseUrl + import.meta.env.VITE_APP_UPLOAD_URL) //
const headers = ref({ Authorization: 'Bearer ' + getToken() })
const fileList = ref([])
const showTip = computed(() => props.isShowTip && (props.fileType || props.fileSize))
@ -187,6 +188,7 @@ function handleUploadSuccess(response, uploadFile) {
uploadList.value = []
number.value = 0
emit('update:modelValue', listToString(fileList.value))
emit('success', listToString(fileList.value))
proxy.$modal.closeLoading()
}
}
@ -215,10 +217,13 @@ function listToString(list, separator) {
}
return strs != '' ? strs.substr(0, strs.length - 1) : ''
}
//
//
function submitUpload() {
this.$refs.upload.submit()
proxy.$refs.upload.submit()
}
defineExpose({
submitUpload,
})
</script>
<style scoped lang="scss">