From 0c56f87e06a62c4c9e5d4c3a5ebc4ec139ab924e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E5=85=B5=20=E6=9D=8E?= Date: Mon, 15 Jan 2024 22:59:22 +0800 Subject: [PATCH] =?UTF-8?q?foreach=E4=B8=ADreturn=E5=B9=B6=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E4=BD=BF=E5=85=B6=E8=B7=B3=E5=87=BA=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E8=BF=99=E4=B8=AA=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=B8=80=E7=9B=B4=E9=83=BD=E4=BC=9A=E6=98=AF?= =?UTF-8?q?false?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DictTag/index.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/DictTag/index.vue b/src/components/DictTag/index.vue index b355a42..7442546 100644 --- a/src/components/DictTag/index.vue +++ b/src/components/DictTag/index.vue @@ -50,12 +50,13 @@ const values = computed(() => { const unmatch = computed(() => { if (props.options?.length == 0 || props.value === '' || props.value === null || typeof props.value === 'undefined') return false; // 传入值为非数组 + let unmatch = false; // 添加一个标志来判断是否有未匹配项 values.value.forEach((item) => { if (!props.options.some((v) => v.value === item)) { - return true; // 如果有未匹配项,将标志设置为true + unmatch = true; // 如果有未匹配项,将标志设置为true } }); - return false; // 返回标志的值 + return unmatch; // 返回标志的值 }); const unmatchArray = computed(() => {