✨(component): 优化 upload 组件代码
This commit is contained in:
parent
e181ba7ad2
commit
e994893bfc
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: "TableRow",
|
name: "TableRow",
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -810,7 +810,10 @@ onBeforeUnmount(() => {
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
<!-- 渲染 -->
|
<!-- 渲染 -->
|
||||||
<template v-for="(children, index) in tableDataSource" :key="index">
|
<template
|
||||||
|
v-for="(children, index) in tableDataSource"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
<table-row
|
<table-row
|
||||||
:id="id"
|
:id="id"
|
||||||
:index="index"
|
:index="index"
|
||||||
|
@ -291,19 +291,11 @@ const uploadChange = (e: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (props.size && props.size != 0) {
|
if (props.size && props.size != 0) {
|
||||||
let _cache = [];
|
|
||||||
for (let i = 0; i < _files.length; i++) {
|
for (let i = 0; i < _files.length; i++) {
|
||||||
let _file = _files[i];
|
let _file = _files[i];
|
||||||
let _size = _file.size;
|
let _size = _file.size;
|
||||||
if (_size > props.size * 1024) {
|
if (_size > props.size * 1024) {
|
||||||
_cache.push(_file);
|
errorF(`文件 ${_file.name} ${sizeErrorMsg},文件最大不可超过${props.size}KB`);
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_cache && _cache.length > 0) {
|
|
||||||
for (let i = 0; i < _cache.length; i++) {
|
|
||||||
let _sizeErrorFile = _cache[i];
|
|
||||||
let errorMsg = `文件 ${_sizeErrorFile.name} ${sizeErrorMsg},文件最大不可超过${props.size}KB`;
|
|
||||||
errorF(errorMsg);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user