1906 FIX search form autocomplete multi terms

This commit is contained in:
2022-08-15 16:57:57 +02:00
parent 1993f80d8d
commit db6a82f7f7
9 changed files with 29 additions and 19 deletions

View File

@ -66,8 +66,11 @@ export default {
console.log('Base created() location',window.location)
let params = new URLSearchParams(window.location.search)
if (params.has('keys')) {
this.$store.commit('Search/setKeys', params.get('keys'))
this.pagetitle = params.get('keys')
const r = /,\s?$/
let keys = params.get('keys').replace(r,'').split(', ')
console.log('Base created, keys', keys)
this.$store.commit('Search/setKeys', keys)
this.pagetitle = keys.join(', ') //params.get('keys')
} else {
this.$store.commit('Search/setKeys', '')
this.pagetitle = 'Base'
@ -92,7 +95,13 @@ export default {
beforeRouteUpdate (to, from, next) {
// when query change launch a new search
console.log('Base beforeRouteUpdate', to, from, next)
this.$store.commit('Search/setKeys', to.query.keys)
// this.$store.commit('Search/setKeys', to.query.keys)
const r = /,\s?$/
let keys = to.query.keys.replace(r,'').split(', ')
console.log('Base created, keys', keys)
this.$store.commit('Search/setKeys', keys)
this.$store.commit('Search/setTerms', to.query.terms)
this.$store.commit('Search/setFilters', to.query.filters)
this.pagetitle = to.query.keys