fix: refs #8410 simplified searchModule function
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
b2414f861b
commit
860f92cb42
|
@ -25,7 +25,6 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
const initialized = ref(false);
|
const initialized = ref(false);
|
||||||
const items = ref([]);
|
const items = ref([]);
|
||||||
const searchingValue = false;
|
|
||||||
const expansionItemElements = reactive({});
|
const expansionItemElements = reactive({});
|
||||||
const pinnedModules = computed(() => {
|
const pinnedModules = computed(() => {
|
||||||
const map = new Map();
|
const map = new Map();
|
||||||
|
@ -177,17 +176,9 @@ function normalize(text) {
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
}
|
}
|
||||||
const searchModule = () => {
|
const searchModule = () => {
|
||||||
const searching = ref(false);
|
const [item] = filteredItems.value;
|
||||||
items.value.some((item) => {
|
if (item) router.push({ name: item.name });
|
||||||
const title = normalize(t(item.title));
|
};
|
||||||
if (title.includes(search.value.toLowerCase()) && !searching.value) {
|
|
||||||
searching.value = true;
|
|
||||||
router.push({ name: item.name });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -203,12 +194,11 @@ const searchModule = () => {
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
autofocus
|
autofocus
|
||||||
@keyup.enter.stop="searchingValue ? searchModule(search) : ''"
|
@keyup.enter.stop="search ? searchModule(search) : ''"
|
||||||
@update:model-value="searchingValue = !!$event"
|
|
||||||
/>
|
/>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<template v-if="filteredPinnedModules.size && !searchingValue">
|
<template v-if="filteredPinnedModules.size && !search">
|
||||||
<LeftMenuItem
|
<LeftMenuItem
|
||||||
v-for="[key, pinnedModule] of filteredPinnedModules"
|
v-for="[key, pinnedModule] of filteredPinnedModules"
|
||||||
:key="key"
|
:key="key"
|
||||||
|
@ -234,9 +224,9 @@ const searchModule = () => {
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(item, index) in filteredItems" :key="item.name">
|
<template v-for="(item, index) in filteredItems" :key="item.name">
|
||||||
<template
|
<template
|
||||||
v-if="searchingValue ||item.children && !filteredPinnedModules.has(item.name)"
|
v-if="search ||item.children && !filteredPinnedModules.has(item.name)"
|
||||||
>
|
>
|
||||||
<LeftMenuItem :item="item" group="modules" :class="searchingValue && index === 0 ? 'searched' : ''">
|
<LeftMenuItem :item="item" group="modules" :class="search && index === 0 ? 'searched' : ''">
|
||||||
<template #side>
|
<template #side>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="item.isPinned === true"
|
v-if="item.isPinned === true"
|
||||||
|
|
Loading…
Reference in New Issue