mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 07:43:42 +08:00 
			
		
		
		
	Merge pull request #286 from yanbowe/main
perf(components): Optimize internationalized menu search code
This commit is contained in:
		@@ -84,20 +84,11 @@ watch(show, async val => {
 | 
			
		||||
/** 查询 */
 | 
			
		||||
function search() {
 | 
			
		||||
  resultOptions.value = routeStore.searchMenus.filter(menu => {
 | 
			
		||||
    return (
 | 
			
		||||
      (keyword.value &&
 | 
			
		||||
        menu.meta?.i18nTitle &&
 | 
			
		||||
        $t(menu.meta?.i18nTitle)
 | 
			
		||||
          .toLocaleLowerCase()
 | 
			
		||||
          .includes(keyword.value.toLocaleLowerCase().trim())) ||
 | 
			
		||||
      menu.meta?.title.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase().trim())
 | 
			
		||||
    );
 | 
			
		||||
    const trimKeyword = keyword.value.toLocaleLowerCase().trim();
 | 
			
		||||
    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() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user