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

dev
文兵 李 2 years ago
parent b783b8d991
commit 0c56f87e06

@ -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(() => {

Loading…
Cancel
Save