From 0a546a182128844c97dc370e5b638c92cae18bf9 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 24 Jan 2024 16:29:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=8C=E6=9D=83=E9=99=90=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=BF=87=E6=BB=A4=E4=B8=8B=E6=8B=89=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC#7195?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/widget/deWidget/DeSelect.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/frontend/src/components/widget/deWidget/DeSelect.vue b/core/frontend/src/components/widget/deWidget/DeSelect.vue index 94f7eabab2..3baf0596a6 100644 --- a/core/frontend/src/components/widget/deWidget/DeSelect.vue +++ b/core/frontend/src/components/widget/deWidget/DeSelect.vue @@ -554,6 +554,7 @@ export default { if (this.isCustomSortWidget && this.element.options.attrs?.sort?.sort === 'custom') { tempData = mergeCustomSortOption(this.element.options.attrs.sort.list, tempData) } + this.filterInvalidValue(tempData) return tempData.map(item => { return { id: item, @@ -561,6 +562,20 @@ export default { } }) }, + filterInvalidValue(data) { + if (this.value === null) { + return + } + if (!data.length) { + this.value = null + return + } + if (this.element.options.attrs.multiple) { + this.value = this.value.filter(item => data.includes(item)) + } else { + this.value = data.includes(this.value) ? this.value : null + } + }, setOptionWidth(event) { this.onFocus = true // 下拉框弹出时,设置弹框的宽度