From fef4f79c576a67ea16608bb6a200fe7f065a6647 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期三, 07 八月 2024 19:43:30 +0800
Subject: [PATCH] 配置bug页面修改

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

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

--
Gitblit v1.8.0