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

View File

@@ -1,11 +1,16 @@
<template>
<div>
<!-- <div>
tagSearchEntry:
{{ tagSearchEntry }}<br />
value:{{ value }}
</div> -->
<span class="v-label v-label--active theme--light">
{{ title }}
</span>
<v-autocomplete
v-bind:value="value"
v-on:input="$emit('input', $event)"
v-on:input="input($event)"
:readonly="readonly"
:items="sourcetags"
:loading="tagSearchUnderway"
@@ -33,9 +38,7 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* 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 {
beforeUpdate() {
// if(this.value==null){
@@ -98,14 +101,18 @@ export default {
}
},
methods: {
addTag() {
input(e){
console.log("input",e);
this.tagSearchEntry = "";
this.$emit('input', e)
},
addTag() {
let theTag = this.tagSearchEntry;
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.value.push(theTag);
this.value.push(theTag);
this.tagSearchEntry = "";
this.$emit("input", this.value);
this.$emit("input", this.value);
},
normalizeTag(tagName) {
return window.$gz.util.normalizeTag(tagName);