Commit e8d41d2b authored by 姬鋆屾's avatar 姬鋆屾

推修改上传限制

parent def939bc
<template>
<div class="myUploadFile">
<a-upload :name="defaultInfo.name" :action="defaultInfo.action" :listType="defaultInfo.listType"
<a-upload
:name="defaultInfo.name"
:action="defaultInfo.action"
:listType="defaultInfo.listType"
:multiple="defaultInfo.multiple"
:showUploadList="defaultInfo.showUploadList"
:defaultFileList="defaultInfo.defaultFileList"
:file-list="defaultInfo.fileList"
:disabled="defaultInfo.disabled"
:directory="defaultInfo.directory"
:data="defaultInfo.objAttach"
:headers="headers"
:remove="uploadRemove"
@change="uploadChange"
@preview="handlePreview"
>
<slot></slot>
</a-upload>
<!-- <a-upload :name="defaultInfo.name" :action="defaultInfo.action" :listType="defaultInfo.listType"
:multiple="defaultInfo.multiple" :showUploadList="defaultInfo.showUploadList"
:defaultFileList="defaultInfo.defaultFileList" :file-list="defaultInfo.fileList" :disabled="defaultInfo.disabled"
:directory="defaultInfo.directory" :data="defaultInfo.objAttach" :headers="headers"
:beforeUpload="beforeImageUpload" :remove="uploadRemove" @change="uploadChange" @preview="handlePreview">
<slot></slot>
</a-upload>
<a-modal :visible="defaultInfo.previewVisible" :footer="null" @cancel="defaultInfo.previewVisible = false">
</a-upload> -->
<a-modal
:visible="defaultInfo.previewVisible"
:footer="null"
@cancel="defaultInfo.previewVisible = false"
>
<img alt="example" style="width: 100%" :src="defaultInfo.previewImage" />
</a-modal>
</div>
......@@ -68,9 +90,7 @@ export default {
"action"
] = `${this.fileCommonupload}?prePath=${this.defaultInfo["prePath"]}`;
} else {
this.defaultInfo[
"action"
] = `${this.fileCommonupload}`;
this.defaultInfo["action"] = `${this.fileCommonupload}`;
}
console.log(this.defaultInfo);
},
......@@ -79,7 +99,7 @@ export default {
},
},
created() { },
created() {},
methods: {
uploadRemove(file) {
if (file.id != undefined) {
......@@ -88,8 +108,8 @@ export default {
this.defaultInfo.fileList = this.defaultInfo.fileList.filter(
(item) => item.uid != file.uid
);
console.log(this.defaultInfo.fileList.length,"=--------")
if(!this.defaultInfo.fileList.length){
console.log(this.defaultInfo.fileList.length, "=--------");
if (!this.defaultInfo.fileList.length) {
this.$emit("input", ""); //相对地址
}
},
......@@ -117,7 +137,7 @@ export default {
return result;
},
uploadChange({ file, fileList }) {
console.log(fileList)
console.log(fileList);
if (file.status === "error") {
return;
this.$message.error(`${file.name} 上传失败.`);
......@@ -164,4 +184,4 @@ export default {
margin-top: 8px;
color: #666;
}
</style>
\ No newline at end of file
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment