|
@@ -3,6 +3,8 @@
|
|
<el-upload
|
|
<el-upload
|
|
v-if="url"
|
|
v-if="url"
|
|
ref="upload"
|
|
ref="upload"
|
|
|
|
+ accept=".mp4"
|
|
|
|
+ :before-upload="beforeUpload"
|
|
:action="url"
|
|
:action="url"
|
|
:list-type="listType"
|
|
:list-type="listType"
|
|
:file-list="fileList"
|
|
:file-list="fileList"
|
|
@@ -12,7 +14,6 @@
|
|
:on-remove="handleRemove"
|
|
:on-remove="handleRemove"
|
|
:on-success="onSuccess"
|
|
:on-success="onSuccess"
|
|
:show-file-list="showList"
|
|
:show-file-list="showList"
|
|
- :accept="accept"
|
|
|
|
>
|
|
>
|
|
<el-button size="small" class="isBtn" v-if="isBtn">点击上传文件</el-button>
|
|
<el-button size="small" class="isBtn" v-if="isBtn">点击上传文件</el-button>
|
|
<template v-else>
|
|
<template v-else>
|
|
@@ -35,7 +36,6 @@
|
|
data: { type: null },
|
|
data: { type: null },
|
|
isBtn: { type: Boolean, default: false },
|
|
isBtn: { type: Boolean, default: false },
|
|
showList: { type: Boolean, default: true },
|
|
showList: { type: Boolean, default: true },
|
|
- accept: { type: String },
|
|
|
|
tip: { type: String, default: undefined },
|
|
tip: { type: String, default: undefined },
|
|
listType: { type: String, default: 'text' },
|
|
listType: { type: String, default: 'text' },
|
|
},
|
|
},
|
|
@@ -83,6 +83,15 @@
|
|
this.$set(this, 'fileList', []);
|
|
this.$set(this, 'fileList', []);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ beforeUpload (file) {
|
|
|
|
+ if (file != null) {
|
|
|
|
+ const isLt1M = file.size / 1024 / 1024 < 5;
|
|
|
|
+ if (!isLt1M) {
|
|
|
|
+ this.$message.error('上传文件大小不能超过5MB!');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|