From baf406e7e271ac90faa3aec31ceb44715331d9d0 Mon Sep 17 00:00:00 2001 From: clddup <105873086+clddup@users.noreply.github.com> Date: 星期五, 19 七月 2024 16:47:21 +0800 Subject: [PATCH] chore: 格式化代码 (#3972) --- src/components/Upload/src/BasicUpload.vue | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/Upload/src/BasicUpload.vue b/src/components/Upload/src/BasicUpload.vue index 36f9eb9..92aff62 100644 --- a/src/components/Upload/src/BasicUpload.vue +++ b/src/components/Upload/src/BasicUpload.vue @@ -59,6 +59,7 @@ import UploadPreviewModal from './components/UploadPreviewModal.vue'; import { BaseFileItem } from './types/typing'; import { buildUUID } from '@/utils/uuid'; + defineOptions({ name: 'BasicUpload' }); const props = defineProps(uploadContainerProps); @@ -86,9 +87,9 @@ return omit(value, 'onChange'); }); - const isFirstRender = ref<boolean>(true) + const isFirstRender = ref<boolean>(true); - function getValue(valueKey="url") { + function getValue(valueKey = 'url') { const list = (fileList.value || []).map((item: any) => { return item[valueKey]; }); @@ -113,7 +114,7 @@ } else if (typeof v == 'string') { values.push(v); } - fileList.value = values.map((item,i) => { + fileList.value = values.map((item) => { if (item && isString(item)) { return { uid: buildUUID(), @@ -127,19 +128,19 @@ }) as any; } emit('update:value', values); - if(!isFirstRender.value){ + if (!isFirstRender.value) { emit('change', values); - isFirstRender.value = false + isFirstRender.value = false; } }, - { - immediate: true, + { + immediate: true, deep: true, }, ); // 涓婁紶modal淇濆瓨鎿嶄綔 - function handleChange(urls: string[],valueKey:string) { + function handleChange(urls: string[], valueKey: string) { fileList.value = [...unref(fileList), ...(genFileListByUrls(urls) || [])]; const values = getValue(valueKey); emit('update:value', values); @@ -147,7 +148,7 @@ } // 棰勮modal淇濆瓨鎿嶄綔 - function handlePreviewChange(fileItems: string[],valueKey:string) { + function handlePreviewChange(fileItems: string[], valueKey: string) { fileList.value = [...(fileItems || [])]; const values = getValue(valueKey); emit('update:value', values); -- Gitblit v1.8.0