Commit bebee4b2 by lijiabin

【需求 17679】 perf: 优化组件

parent 067c7e80
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</div> </div>
</div> </div>
</el-popover> </el-popover>
<div class="flex flex-wrap gap-2"> <div class="flex flex-wrap gap-2 mt-2">
<el-tag <el-tag
v-for="tag in selectedTags" v-for="tag in selectedTags"
:key="tag.value" :key="tag.value"
......
...@@ -54,7 +54,16 @@ const initFileList = () => { ...@@ -54,7 +54,16 @@ const initFileList = () => {
} }
}) })
} }
initFileList() // 监听 modelValue 变化,重新初始化 fileList
watch(
() => modelValue.value,
(newVal) => {
if (newVal != undefined) {
initFileList()
}
},
{ immediate: true },
)
watch(fileList, (newVal) => { watch(fileList, (newVal) => {
if (isArrayOfModelValue) { if (isArrayOfModelValue) {
...@@ -87,7 +96,6 @@ const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => { ...@@ -87,7 +96,6 @@ const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
// 在这里处理上传逻辑 // 在这里处理上传逻辑
const handleChange = async (uploadFile: UploadUserFile, uploadFiles: UploadUserFile[]) => { const handleChange = async (uploadFile: UploadUserFile, uploadFiles: UploadUserFile[]) => {
await nextTick()
if (hasReachedLimit.value) { if (hasReachedLimit.value) {
ElMessage.error(`最多上传${limit}个文件`) ElMessage.error(`最多上传${limit}个文件`)
uploadFiles.pop() uploadFiles.pop()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment