From 0c56f87e06a62c4c9e5d4c3a5ebc4ec139ab924e Mon Sep 17 00:00:00 2001
From: 文兵 李 <zhizu1882@outlook.com>
Date: 星期一, 15 一月 2024 22:59:22 +0800
Subject: [PATCH] foreach中return并不会使其跳出循环,导致这个计算属性一直都会是false

---
 src/components/ImageUpload/index.vue |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue
index 47945dd..ae5cd45 100644
--- a/src/components/ImageUpload/index.vue
+++ b/src/components/ImageUpload/index.vue
@@ -46,7 +46,10 @@
 import { globalHeaders } from '@/utils/request';
 
 const props = defineProps({
-  modelValue: [String, Object, Array],
+  modelValue: {
+    type: [String, Object, Array],
+    default: () => []
+  },
   // 鍥剧墖鏁伴噺闄愬埗
   limit: propTypes.number.def(5),
   // 澶у皬闄愬埗(MB)
@@ -78,14 +81,14 @@
 
 watch(
   () => props.modelValue,
-  async (val) => {
+  async (val: string) => {
     if (val) {
       // 棣栧厛灏嗗�艰浆涓烘暟缁�
       let list: OssVO[] = [];
       if (Array.isArray(val)) {
         list = val as OssVO[];
       } else {
-        const res = await listByIds(val as string);
+        const res = await listByIds(val);
         list = res.data;
       }
       // 鐒跺悗灏嗘暟缁勮浆涓哄璞℃暟缁�

--
Gitblit v1.9.3