|
@@ -25,7 +25,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
submit() {
|
|
|
- console.log("search clicked", this.typed, this.autocomplete);
|
|
|
+ console.log("search submited", this.typed, this.autocomplete);
|
|
|
// New search is triggered by Base.vue with router (which will also fill the store)
|
|
|
this.$router.push({name:'base', query:{keys:this.typed,term:this.autocomplete}})
|
|
|
// this.$router.push({
|
|
@@ -35,9 +35,16 @@ export default {
|
|
|
},
|
|
|
onAutoCompleteSelect(event, ui){
|
|
|
event.preventDefault();
|
|
|
- // console.log('autoCompleteSelect', event, ui);
|
|
|
+ console.log('autoCompleteSelect', event, ui);
|
|
|
this.typed = ui.item.label
|
|
|
- this.autocomplete = ui.item.value
|
|
|
+ setTimeout(function(){
|
|
|
+ console.log('update autocomplete value after settimeout');
|
|
|
+ this.autocomplete = ui.item.value
|
|
|
+ if(this.typed !== this.keys && this.autocomplete !== this.term){
|
|
|
+ this.submit()
|
|
|
+ }
|
|
|
+ }.bind(this), 1)
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
directives: {
|
|
@@ -60,12 +67,17 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
+ typed(n, o){
|
|
|
+ console.log('typed changed', o, n);
|
|
|
+ // is changed also when autocomplete change it ...
|
|
|
+ this.autocomplete = null
|
|
|
+ },
|
|
|
keys(n, o){
|
|
|
- console.log('keys changed', n, o);
|
|
|
+ console.log('keys changed', o, n);
|
|
|
this.typed = n
|
|
|
},
|
|
|
term(n, o){
|
|
|
- console.log('autocomplete changed', n, o);
|
|
|
+ console.log('autocomplete changed', o, n);
|
|
|
this.autocomplete = n
|
|
|
}
|
|
|
},
|