mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-14 13:26:45 +08:00
feat:增加上传文件类型判断
This commit is contained in:
@@ -196,6 +196,18 @@ export default {
|
||||
//上传文件
|
||||
const handleChange = (info) => {
|
||||
console.log("info", info);
|
||||
|
||||
if(info){
|
||||
var FileExt = info.file.name.replace(/.+\./, "");
|
||||
if (['xls','xlsx'].indexOf(FileExt.toLowerCase()) === -1){
|
||||
state.fileList = [];
|
||||
state.uploadpercent = -1;
|
||||
message.destroy()
|
||||
message.error("请上传正确的文件格式")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
state.addLoading = true;
|
||||
state.uploadErr = false;
|
||||
state.uploadpercent = parseInt(info.file.percent);
|
||||
|
||||
Reference in New Issue
Block a user