From 54a72ae51d8f17379fe515eb66759ec7de0663d0 Mon Sep 17 00:00:00 2001 From: zhangxiao <898441624@qq.com> Date: 星期一, 12 八月 2024 10:42:51 +0800 Subject: [PATCH] fix: 上传图片优化 --- src/components/upload/index.vue | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/components/upload/index.vue b/src/components/upload/index.vue index 66900de..b58aeaf 100644 --- a/src/components/upload/index.vue +++ b/src/components/upload/index.vue @@ -10,7 +10,10 @@ </template> <script setup> - import { computed, ref, watch, watchEffect } from 'vue'; + import { computed, ref, onMounted, watch, watchEffect } from 'vue'; + import { useUserStore } from '@/store'; + + const userStore = useUserStore(); const props = defineProps({ limit: { type: Number, @@ -21,7 +24,7 @@ }); const emit = defineEmits(['update:fileList', 'success']); - + const urls = computed(() => props.url); const fileList = ref([]); watch( @@ -41,6 +44,23 @@ } ); + onMounted(() => { + if (urls.value) { + fileList.value = urls.value.split(',').map((item) => ({ + uid: item, + name: item, + status: 'done', + url: item, + })); + } + + // console.log( + // window.location.origin, + // import.meta.env.VITE_API_BASE_URL, + // 8988 + // ); + }); + // console.log(urls.value, 8988); const handleChange = (fileList) => { -- Gitblit v1.8.0