chore: improve filter (#8262)

This commit is contained in:
neverland
2021-03-04 11:27:39 +08:00
committed by GitHub
parent 9fd71923f9
commit 12be46fad8
10 changed files with 31 additions and 37 deletions
+4 -4
View File
@@ -98,11 +98,11 @@ export default createComponent({
selectedOption: option,
};
const next = optionsCursor.filter(
const next = optionsCursor.find(
(item) => item[valueKey] === option[valueKey]
);
if (next.length) {
optionsCursor = next[0][childrenKey];
if (next) {
optionsCursor = next[childrenKey];
}
return tab;
@@ -157,7 +157,7 @@ export default createComponent({
const selectedOptions = state.tabs
.map((tab) => tab.selectedOption)
.filter((item) => !!item);
.filter(Boolean);
const eventParams = {
value: option[valueKey],