完成:安全维保管理模块
This commit is contained in:
@@ -50,6 +50,7 @@
|
|||||||
v-model:value="files"
|
v-model:value="files"
|
||||||
:item-style="{ width: '90px', height: '90px' }"
|
:item-style="{ width: '90px', height: '90px' }"
|
||||||
:limit="20"
|
:limit="20"
|
||||||
|
:upload-handler="uploadHandler"
|
||||||
@upload="onUpload"
|
@upload="onUpload"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -176,6 +177,25 @@
|
|||||||
form.replaceAccessories = e.target.value;
|
form.replaceAccessories = e.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 上传事件 */
|
||||||
|
const uploadHandler = (file: File) => {
|
||||||
|
const item: ItemType = {
|
||||||
|
file,
|
||||||
|
uid: (file as any).uid,
|
||||||
|
name: file.name
|
||||||
|
};
|
||||||
|
if (!file.type.startsWith('image')) {
|
||||||
|
message.error('只能选择图片');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (file.size / 1024 / 1024 > 2) {
|
||||||
|
message.error('大小不能超过 2MB');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onUpload(item);
|
||||||
|
};
|
||||||
|
|
||||||
// 上传文件
|
// 上传文件
|
||||||
const onUpload = (d: ItemType) => {
|
const onUpload = (d: ItemType) => {
|
||||||
uploadFile(<File>d.file)
|
uploadFile(<File>d.file)
|
||||||
|
|||||||
Reference in New Issue
Block a user