mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 14:10:27 +08:00
解决 cl-upload 在 form 分组下同个 prop 预览不显示问题
This commit is contained in:
parent
3a55028265
commit
522aa17441
@ -16,7 +16,6 @@
|
|||||||
class="cl-upload-item__image-cover"
|
class="cl-upload-item__image-cover"
|
||||||
fit="contain"
|
fit="contain"
|
||||||
:src="item.preload || url"
|
:src="item.preload || url"
|
||||||
lazy
|
|
||||||
@error="item.error = '加载失败'"
|
@error="item.error = '加载失败'"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -355,17 +355,17 @@ async function httpRequest(req: any, item?: Upload.Item) {
|
|||||||
toUpload(req.file, {
|
toUpload(req.file, {
|
||||||
prefixPath: props.prefixPath,
|
prefixPath: props.prefixPath,
|
||||||
onProgress(progress) {
|
onProgress(progress) {
|
||||||
item.progress = progress;
|
item!.progress = progress;
|
||||||
emit("progress", item);
|
emit("progress", item);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
Object.assign(item, res);
|
Object.assign(item!, res);
|
||||||
emit("success", item);
|
emit("success", item);
|
||||||
update();
|
update();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
item.error = err.message;
|
item!.error = err.message;
|
||||||
emit("error", item);
|
emit("error", item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -418,14 +418,19 @@ watch(
|
|||||||
|
|
||||||
list.value = urls
|
list.value = urls
|
||||||
.map((url, index) => {
|
.map((url, index) => {
|
||||||
|
const old = list.value[index] || {};
|
||||||
|
|
||||||
return Object.assign(
|
return Object.assign(
|
||||||
{
|
{
|
||||||
type: getType(url),
|
type: getType(url),
|
||||||
progress: 100,
|
progress: 100,
|
||||||
uid: uuid(),
|
uid: uuid()
|
||||||
url
|
|
||||||
},
|
},
|
||||||
list.value[index]
|
old,
|
||||||
|
{
|
||||||
|
url,
|
||||||
|
preload: old.url == url ? old.preload : url // 防止重复预览
|
||||||
|
}
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.filter((_, i) => {
|
.filter((_, i) => {
|
||||||
|
@ -3,8 +3,8 @@ export default () => {
|
|||||||
label: "文件上传",
|
label: "文件上传",
|
||||||
description: "基于 el-upload 封装的文件上传组件",
|
description: "基于 el-upload 封装的文件上传组件",
|
||||||
author: "COOL",
|
author: "COOL",
|
||||||
version: "1.1.1",
|
version: "1.1.2",
|
||||||
updateTime: "2024-02-19",
|
updateTime: "2024-02-21",
|
||||||
demo: [
|
demo: [
|
||||||
{
|
{
|
||||||
name: "基础用法",
|
name: "基础用法",
|
||||||
|
Loading…
Reference in New Issue
Block a user