限制文件类型
This commit is contained in:
parent
dd02933da1
commit
6676360573
@ -53,11 +53,13 @@
|
||||
class="upload-demo"
|
||||
style="width: 100%"
|
||||
drag
|
||||
accept=".apk, .ipa, .wgt"
|
||||
:headers="{ Token: userStore.token }"
|
||||
:action="base_url + '/upload/file'"
|
||||
:limit="1"
|
||||
:on-success="handleFile"
|
||||
:on-exceed="handleExceed"
|
||||
:before-upload="handleBeforeUpload"
|
||||
ref="upload"
|
||||
>
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
@ -140,6 +142,18 @@ const handleExceed = (files: any) => {
|
||||
upload.value!.submit();
|
||||
};
|
||||
|
||||
const appTypeList = [".apk", ".ipa", ".wgt"];
|
||||
const handleBeforeUpload = (e: any) => {
|
||||
let a = appTypeList.find((item: any) => {
|
||||
return item == e?.name?.substring(e.name.length - 4, e.name.length);
|
||||
});
|
||||
if (a) return true;
|
||||
else {
|
||||
ElMessage.error("仅支持上传APK/IPA/WGT文件");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// 弹窗标题
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == "edit" ? "编辑app更新" : "新增app更新";
|
||||
|
Loading…
x
Reference in New Issue
Block a user