| | |
| | | :action="uploadFileUrl"
|
| | | :before-upload="handleBeforeUpload"
|
| | | :file-list="fileList"
|
| | | :data="data"
|
| | | :limit="limit"
|
| | | :on-error="handleUploadError"
|
| | | :on-exceed="handleExceed"
|
| | |
| | |
|
| | | const props = defineProps({
|
| | | modelValue: [String, Object, Array],
|
| | | // 上传接口地址
|
| | | action: {
|
| | | type: String,
|
| | | default: "/common/upload"
|
| | | },
|
| | | // 上传携带的参数
|
| | | data: {
|
| | | type: Object
|
| | | },
|
| | | // 数量限制
|
| | | limit: {
|
| | | type: Number,
|
| | | default: 5,
|
| | | default: 5
|
| | | },
|
| | | // 大小限制(MB)
|
| | | fileSize: {
|
| | | type: Number,
|
| | | default: 5,
|
| | | default: 5
|
| | | },
|
| | | // 文件类型, 例如['png', 'jpg', 'jpeg']
|
| | | fileType: {
|
| | | type: Array,
|
| | | default: () => ["doc", "xls", "ppt", "txt", "pdf"],
|
| | | default: () => ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "pdf"]
|
| | | },
|
| | | // 是否显示提示
|
| | | isShowTip: {
|
| | |
| | | const number = ref(0);
|
| | | const uploadList = ref([]);
|
| | | const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
| | | const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 上传文件服务器地址
|
| | | const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action); // 上传文件服务器地址
|
| | | const headers = ref({ Authorization: "Bearer " + getToken() });
|
| | | const fileList = ref([]);
|
| | | const showTip = computed(
|
| | |
| | | // 上传失败
|
| | | function handleUploadError(err) {
|
| | | proxy.$modal.msgError("上传文件失败");
|
| | | proxy.$modal.closeLoading();
|
| | | }
|
| | |
|
| | | // 上传成功回调
|