瀏覽代碼

修改上传文件

master
yangzhou-cyber 3 年之前
父節點
當前提交
e2884ef9b3
共有 1 個檔案被更改,包括 16 行新增1 行删除
  1. +16
    -1
      src/views/second/summary/index.vue

+ 16
- 1
src/views/second/summary/index.vue 查看文件

@@ -162,6 +162,7 @@ export default {
dataList: [],
loading: false,
file: {},
uploading:false
};
},
created() {
@@ -215,7 +216,20 @@ export default {
input.addEventListener(
"change",
(upload = (e) => {
input.removeEventListener('change',upload)
if(this.uploading){
this.$message({
type:"warning",
message:"正在上传"
})
return
}
this.uploading=true
let file = e.target.files[0];
if(!file){
this.uploading=false
return
}
let MAXSIZE = 5 * 1024 * 1024;
if (file.size > MAXSIZE) {
this.$message.error("上传文件不得超过5M");
@@ -237,7 +251,8 @@ export default {
})
.catch((e) => {
this.$message.error("上传文件失败");
}).catch(e=>{
}).finally(e=>{
this.uploading=false
this.getFile()
});
})

Loading…
取消
儲存