This commit is contained in:
2021-02-09 16:11:32 +00:00
parent 37a2e7907f
commit d8d8e667e6

View File

@@ -1,11 +1,16 @@
<template> <template>
<div> <div>
<!-- <div>
tagSearchEntry:
{{ tagSearchEntry }}<br />
value:{{ value }}
</div> -->
<span class="v-label v-label--active theme--light"> <span class="v-label v-label--active theme--light">
{{ title }} {{ title }}
</span> </span>
<v-autocomplete <v-autocomplete
v-bind:value="value" v-bind:value="value"
v-on:input="$emit('input', $event)" v-on:input="input($event)"
:readonly="readonly" :readonly="readonly"
:items="sourcetags" :items="sourcetags"
:loading="tagSearchUnderway" :loading="tagSearchUnderway"
@@ -33,9 +38,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* eslint-disable */ /* eslint-disable */
//////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////
//NOTE: I had some concerns about how the selection is made, but leaving it for now
//basically the typed text stays after you select from dropdown, however, it clears as soon as you tab off
//and in theory it could help if picking more than one tag that have similar selection criteria
export default { export default {
beforeUpdate() { beforeUpdate() {
// if(this.value==null){ // if(this.value==null){
@@ -98,14 +101,18 @@ export default {
} }
}, },
methods: { methods: {
addTag() { input(e){
console.log("input",e);
this.tagSearchEntry = "";
this.$emit('input', e)
},
addTag() {
let theTag = this.tagSearchEntry; let theTag = this.tagSearchEntry;
theTag = this.normalizeTag(theTag); theTag = this.normalizeTag(theTag);
//Maybe need to make sure there are no existing of the same tag? Although that shouldn't be possible technically
this.sourcetags.push(theTag); this.sourcetags.push(theTag);
this.value.push(theTag); this.value.push(theTag);
this.tagSearchEntry = ""; this.tagSearchEntry = "";
this.$emit("input", this.value); this.$emit("input", this.value);
}, },
normalizeTag(tagName) { normalizeTag(tagName) {
return window.$gz.util.normalizeTag(tagName); return window.$gz.util.normalizeTag(tagName);