From c79dd89ef0c5a0e75c86136202e5c408c184a2f8 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期六, 24 八月 2024 19:25:39 +0800
Subject: [PATCH] 新建会话修改
---
src/components/upload/index.vue | 66 ++++++++++++++++++---------------
1 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/src/components/upload/index.vue b/src/components/upload/index.vue
index 0329488..3600546 100644
--- a/src/components/upload/index.vue
+++ b/src/components/upload/index.vue
@@ -5,12 +5,16 @@
:limit="limit"
:action="action"
@change="handleChange"
+ @before-remove="beforeRemove"
image-preview
/>
</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,
@@ -20,47 +24,49 @@
url: String, //鍥炴樉鐨勬枃浠跺湴鍧�
});
- const emit = defineEmits(['update:fileList', 'success']);
-
+ const emit = defineEmits(['update:fileList', 'success', 'handleRemove']);
+ const urls = computed(() => props.url);
const fileList = ref([]);
- // const urls = computed(() => {
- // debugger;
- // console.log(props.url, 999999);
- // // if (props.urlS) {
- // // console.log(props.urlS, 999999);
- // // return props.urlS.split(',');
- // // }
- // // return props.urlS ? [props.urlS] : [];
- // });
- // watchEffect(() => {
- // fileList.value = urls.value.map((item) => ({
- // uid: item,
- // name: item,
- // status: 'done',
- // url: item,
- // }));
- // });
watch(
() => props.url,
(newVal) => {
- debugger;
- console.log(newVal, 8888);
- // if (newVal) {
- // fileList.value = newVal.split(',').map((item) => ({
- // uid: item,
- // name: item,
- // status: 'done',
- // url: item,
- // }));
- // }
+ 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(
+ // window.location.origin,
+ // import.meta.env.VITE_API_BASE_URL,
+ // 8988
+ // );
+ });
+
// console.log(urls.value, 8988);
+ const beforeRemove = (file) => {
+ emit('handleRemove');
+ fileList.value = [];
+ };
const handleChange = (fileList) => {
emit('update:fileList', fileList);
--
Gitblit v1.8.0