1906 FIX search form autocomplete multi terms
This commit is contained in:
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
web/themes/custom/materiotheme/assets/dist/module-base.e079ad7538d0d2d307c8.bundle.js.gz
vendored
Normal file
BIN
web/themes/custom/materiotheme/assets/dist/module-base.e079ad7538d0d2d307c8.bundle.js.gz
vendored
Normal file
Binary file not shown.
@@ -124,7 +124,7 @@ export default {
|
||||
watch: {
|
||||
typed(n, o){
|
||||
console.log('watch typed changed o:' + o + ' n:' +n)
|
||||
// todo remove terms from autocomplete if removed from typed
|
||||
// remove terms from autocomplete if removed from typed
|
||||
const r = /,\s?$/
|
||||
let tag_list = n.replace(r,'').split(', ')
|
||||
console.log('watch typed tag_list', tag_list)
|
||||
@@ -149,7 +149,8 @@ export default {
|
||||
},
|
||||
created() {
|
||||
// fill component values with store values in case of direct page loading
|
||||
this.typed = this.keys
|
||||
console.log('SearchForm created, this.keys', this.keys)
|
||||
this.typed = this.keys.length ? this.keys.join(', ') + ', ' : ''
|
||||
this.autocomplete = this.terms
|
||||
},
|
||||
mounted(){
|
||||
|
@@ -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
|
||||
|
@@ -104,15 +104,15 @@ export default {
|
||||
// actions
|
||||
actions: {
|
||||
newSearch ({ dispatch, commit, state }) {
|
||||
console.log('Search newSearch')
|
||||
console.log('Search newSearch, state.keys', state.keys)
|
||||
commit('resetUuids')
|
||||
commit('resetItems')
|
||||
commit('resetCount')
|
||||
commit('resetNoresults')
|
||||
commit('resetOffset')
|
||||
commit('resetInfos')
|
||||
if (state.keys || state.terms) {
|
||||
this.commit('Common/setPagetitle', state.keys)
|
||||
if (state.keys || state.terms.length) {
|
||||
this.commit('Common/setPagetitle', state.keys.join(', '))
|
||||
} else {
|
||||
this.commit('Common/setPagetitle', 'Base')
|
||||
}
|
||||
|
Reference in New Issue
Block a user