From 6860f30ff7ab6cb5097e63b37411364827e08bfa Mon Sep 17 00:00:00 2001
From: zhangxiao <898441624@qq.com>
Date: 星期二, 06 八月 2024 10:48:08 +0800
Subject: [PATCH] fix: 接口对接

---
 src/components/upload/index.vue |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/components/upload/index.vue b/src/components/upload/index.vue
index e0c517e..66900de 100644
--- a/src/components/upload/index.vue
+++ b/src/components/upload/index.vue
@@ -10,18 +10,39 @@
 </template>
 
 <script setup>
-  import { ref } from 'vue';
+  import { computed, ref, watch, watchEffect } from 'vue';
   const props = defineProps({
     limit: {
       type: Number,
       default: 1,
     },
     action: String, // 涓婁紶鐨勬湇鍔″櫒鍦板潃
+    url: String, //鍥炴樉鐨勬枃浠跺湴鍧�
   });
 
   const emit = defineEmits(['update:fileList', 'success']);
+
   const fileList = ref([]);
 
+  watch(
+    () => props.url,
+    (newVal) => {
+      if (newVal) {
+        fileList.value = newVal.split(',').map((item) => ({
+          uid: item,
+          name: item,
+          status: 'done',
+          url: item,
+        }));
+      }
+    },
+    {
+      deep: true, // 寮�鍚繁搴︾洃鍚�
+    }
+  );
+
+  // console.log(urls.value, 8988);
+
   const handleChange = (fileList) => {
     emit('update:fileList', fileList);
     const successFiles = fileList.filter((item) => item.status === 'done');

--
Gitblit v1.8.0