diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue index 2e491e97d..baa0e05ec 100644 --- a/src/components/LeftMenu.vue +++ b/src/components/LeftMenu.vue @@ -25,6 +25,7 @@ const props = defineProps({ }); const initialized = ref(false); const items = ref([]); +const searchingValue = ref(false); const expansionItemElements = reactive({}); const pinnedModules = computed(() => { const map = new Map(); @@ -176,33 +177,16 @@ function normalize(text) { .toLowerCase(); } const searchModule = () => { - const moduleArrays = ref([]); - items.value.forEach((item) => { - moduleArrays.value.push({ - title: getLocale(item.title).normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase(), - name: item.name - }); - }) - const searching = ref(false) - moduleArrays.value.find((module) => { - console.log(module.title); - if (module.title.includes(search.value.toLowerCase()) && !searching.value) { + const searching = ref(false); + items.value.some((item) => { + const title = normalize(t(item.title)); + if (title.includes(search.value.toLowerCase()) && !searching.value) { searching.value = true; - router.push({ name: module.name }); + router.push({ name: item.name }); + return true; } - }) -} - -const getLocale = (label) => { - const globalLocale = t(label); - return globalLocale; -}; -const searchingValue = ref(false); -function searchingFunction(evt) { - searchingValue.value = true; - if(evt === null) { - searchingValue.value = false; - } + return false; + }); } @@ -212,14 +196,15 @@ function searchingFunction(evt) {