Fix category autocomplete.

This commit is contained in:
James Cole
2020-07-19 18:03:02 +02:00
parent 3619427f60
commit edf6ece7cb
3 changed files with 12 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -49,7 +49,7 @@
:open-on-empty=true :open-on-empty=true
:open-on-focus=true :open-on-focus=true
v-on:input="selectedItem" v-on:input="selectedItem"
:async-src="categoryAutoCompleteURI" :async-function="categoryAutoCompleteURI"
v-model="name" v-model="name"
:target="target" :target="target"
item-key="name" item-key="name"
@@ -91,6 +91,15 @@
hasError: function () { hasError: function () {
return this.error.length > 0; return this.error.length > 0;
}, },
aSyncFunction: function (query, done) {
axios.get(this.categoryAutoCompleteURI + query)
.then(res => {
done(res.data);
})
.catch(err => {
// any error handler
})
},
handleInput(e) { handleInput(e) {
if (typeof this.$refs.input.value === 'string') { if (typeof this.$refs.input.value === 'string') {
this.$emit('input', this.$refs.input.value); this.$emit('input', this.$refs.input.value);