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
@@ -206,16 +206,16 @@ export default createComponent({
return;
}
const match = children.filter((item) => String(item.index) === index);
const match = children.find((item) => String(item.index) === index);
if (match[0]) {
match[0].$el.scrollIntoView();
if (match) {
match.$el.scrollIntoView();
if (props.sticky && props.stickyOffsetTop) {
setRootScrollTop(getRootScrollTop() - props.stickyOffsetTop);
}
emit('select', match[0].index);
emit('select', match.index);
}
};