perf(components): Optimize menu search code

This commit is contained in:
燕博文 2023-10-18 21:13:05 +08:00
parent 8c1ef4b0fd
commit 296a2d2f0e

View File

@ -88,11 +88,7 @@ function search() {
const title = (menu.meta.i18nTitle ? $t(menu.meta.i18nTitle) : menu.meta.title).toLocaleLowerCase();
return trimKeyword && title.includes(trimKeyword);
});
if (resultOptions.value?.length > 0) {
activePath.value = resultOptions.value[0].path;
} else {
activePath.value = '';
}
activePath.value = resultOptions.value[0]?.path ?? '';
}
function handleClose() {