From 7f1933681ada121d1fcb5a4d0095b9ff0d5d8891 Mon Sep 17 00:00:00 2001 From: 26947 <12@1> Date: Sat, 1 Jun 2024 23:03:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E7=BB=84=E5=BB=BA=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8?= =?UTF-8?q?v-model=E7=BB=91=E5=AE=9A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/common/file/fileUpload/index.vue | 15 +++++++++++++-- pages/work/index.vue | 9 +++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pages/common/file/fileUpload/index.vue b/pages/common/file/fileUpload/index.vue index bc3d1e0..1ed96a2 100644 --- a/pages/common/file/fileUpload/index.vue +++ b/pages/common/file/fileUpload/index.vue @@ -26,6 +26,7 @@ const { proxy } = getCurrentInstance(); const uploadQiNiuDomain = config1.uploadQiNiuDomain; const props = defineProps({ + modelValue: [String, Object, Array], fileTypeInfo: { type: String, default: "image", @@ -99,7 +100,7 @@ const afterRead = async (event) => { url: store.state.user.QNDomain + result, furl: result }); - emit('fileList', fileList1.value); + emit("update:modelValue", fileList1.value); fileListLen++; } catch (error) { console.error("上传失败:", error); @@ -205,7 +206,17 @@ const typeInfo = () => { store.dispatch('getPhoneType'); console.log(store.state.user.phoneType); }; - + // 对象转成指定字符串分隔 + function listToString(list, separator) { + let strs = ""; + separator = separator || ","; + for (let i in list) { + if (list[i].url) { + strs += list[i].url + separator; + } + } + return strs != '' ? strs.substr(0, strs.length - 1) : ''; + } typeInfo(); diff --git a/pages/work/index.vue b/pages/work/index.vue index eacbc8e..4d36ed7 100644 --- a/pages/work/index.vue +++ b/pages/work/index.vue @@ -71,8 +71,8 @@ - - + + @@ -105,10 +105,7 @@ const QNDomain = store.state.user.QNDomain } ]) const fileList1 = ref([]) -const handleFileList = (newFileList) => { - fileList1.value = newFileList; - console.log('Updated fileList:', fileList1.value); -} + function clickBannerItem(item) { console.info(item)