foreach中return并不会使其跳出循环,导致这个计算属性一直都会是false

This commit is contained in:
文兵 李 2024-01-15 22:59:22 +08:00
parent b783b8d991
commit 0c56f87e06

View File

@ -50,12 +50,13 @@ const values = computed(() => {
const unmatch = computed(() => { const unmatch = computed(() => {
if (props.options?.length == 0 || props.value === '' || props.value === null || typeof props.value === 'undefined') return false; if (props.options?.length == 0 || props.value === '' || props.value === null || typeof props.value === 'undefined') return false;
// //
let unmatch = false; //
values.value.forEach((item) => { values.value.forEach((item) => {
if (!props.options.some((v) => v.value === item)) { if (!props.options.some((v) => v.value === item)) {
return true; // true unmatch = true; // true
} }
}); });
return false; // return unmatch; //
}); });
const unmatchArray = computed(() => { const unmatchArray = computed(() => {