Fix filter added twice and remove unnecessary _and node. (#9116)

This commit is contained in:
Oreille
2021-10-25 17:37:47 +02:00
committed by GitHub
parent c94d0c4bfe
commit 7eb2cb1137
2 changed files with 11 additions and 5 deletions

View File

@@ -112,10 +112,16 @@ export default defineComponent({
}
},
set(newVal) {
if (newVal.length === 0) {
emit('input', null);
} else {
emit('input', { _and: newVal });
switch (newVal.length) {
case 0:
emit('input', null);
break;
case 1:
emit('input', newVal[0]);
break;
default:
emit('input', { _and: newVal });
break;
}
},
});

View File

@@ -381,7 +381,7 @@ export default defineComponent({
const field = currentCollection.value.meta.archive_field;
if (!field) return filter.value;
if (!field) return null;
let archiveValue: any = currentCollection.value.meta.archive_value;
if (archiveValue === 'true') archiveValue = true;