Skip to content

Commit

Permalink
fix: Menu freezes when searching. (PanJiaChen#2573)
Browse files Browse the repository at this point in the history
* fix: Menu freezes when searching.

* fix variable.

* fix variable.
  • Loading branch information
EdwinBetanc0urt authored Aug 12, 2024
1 parent 5818686 commit 1f29234
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/components/HeaderSearch/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
@change="change"
>
<el-option
v-for="element in options"
:key="element.item.path"
v-for="(element, key) in options"
:key="key"
:value="element.item"
:label="element.item.title.join(' > ')"
>
Expand All @@ -34,15 +34,21 @@
</template>

<script>
// import i18n from '@/lang'
// fuse is a lightweight fuzzy-search module
// make search results more in line with expectations
import Fuse from 'fuse.js'
import path from 'path'
// Utils and Helper Methods
import { generateTitle } from '@/utils/i18n'
// import i18n from '@/lang'
// import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
// import { getUuidv4 } from '@/utils/ADempiere/recordUtil'
export default {
name: 'HeaderSearch',
data() {
return {
search: '',
Expand All @@ -52,6 +58,7 @@ export default {
fuse: undefined
}
},
computed: {
isMobile() {
return this.$store.state.app.device === 'mobile'
Expand All @@ -72,6 +79,7 @@ export default {
return ''
}
},
watch: {
lang() {
this.searchPool = this.generateRoutes(this.routes)
Expand All @@ -94,9 +102,13 @@ export default {
}
}
},
mounted() {
this.searchPool = this.generateRoutes(this.routes)
this.searchPool = this.generateRoutes(
this.routes
)
},
methods: {
openSearch() {
if (this.show) {
Expand Down Expand Up @@ -196,8 +208,11 @@ export default {
for (const router of routes) {
// skip hidden router
// if (router.meta && router.meta.isIndex) { continue }
const pathGenerated = path.resolve(basePath, router.path)
// const uuid = (!isEmptyValue(router.meta) && !isEmptyValue(router.meta.uuid)) ? router.meta.uuid : getUuidv4()
const data = {
path: path.resolve(basePath, router.path),
path: pathGenerated,
// key: pathGenerated + '_' + uuid,
title: [...prefixTitle],
meta: router.meta,
name: router.name
Expand Down Expand Up @@ -241,6 +256,7 @@ export default {
}
}
</script>

<style>
.search-menu-mobile {
position: absolute;
Expand Down

0 comments on commit 1f29234

Please sign in to comment.