This commit is contained in:
2021-02-09 18:03:43 +00:00
parent c2f7c17c8b
commit ced339eac5
2 changed files with 19 additions and 37 deletions

View File

@@ -72,10 +72,9 @@
"node": true
},
"extends": [
"plugin:vue/essential",
"plugin:vue/strongly-recommended",
"@vue/prettier"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
@@ -88,4 +87,4 @@
"browserslist": [
"defaults"
]
}
}

View File

@@ -1,16 +1,11 @@
<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="input($event)"
:value="value"
@input="input($event)"
:readonly="readonly"
:items="sourcetags"
:loading="tagSearchUnderway"
@@ -41,11 +36,8 @@
export default {
beforeUpdate() {
// if(this.value==null){
// this.value=[];
// }
//Set the initial list items based on the record items, this only needs to be called once at init
if (!this.initialized && this.value!=null && this.value.length > 0) {
if (!this.initialized && this.value != null && this.value.length > 0) {
this.sourcetags = this.value;
this.initialized = true;
}
@@ -60,11 +52,11 @@ export default {
};
},
props: {
value: {
value: {
default: [],
type: Array
},
// value: Array,
// value: Array,
label: String,
readonly: { type: Boolean, default: false }
},
@@ -80,7 +72,7 @@ export default {
//We never expect there to be no data here
if (!res.hasOwnProperty("data")) {
throw new Error(res);
throw new Error(res);
}
//adding this to the property will automatically have it cached by the autocomplete component
//as cache-items has been set so this just needs to be set here once and all is well in future
@@ -101,38 +93,29 @@ export default {
}
},
methods: {
offerAdd(){
if(this.tagSearchEntry==null || this.tagSearchEntry==""){
offerAdd() {
if (this.tagSearchEntry == null || this.tagSearchEntry == "") {
return false;
}
let searchTag=this.normalizeTag(this.tagSearchEntry);
if (
!editItem.filter.items.some(
z => z.op == filterItem.op && z.value == filterItem.value
)
console.log("offerAdd",{searchtag:searchTag,val:this.value});
if(this.value.some)
let searchTag = this.normalizeTag(this.tagSearchEntry);
if (this.value.some((z) => z == searchTag)) return false;
return true;
},
input(e){
console.log("input",e);
input(e) {
console.log("input", e);
this.tagSearchEntry = "";
this.$emit('input', e)
this.$emit("input", e);
},
addTag() {
addTag() {
let theTag = this.tagSearchEntry;
theTag = this.normalizeTag(theTag);
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);
return window.$gz.util.normalizeTag(tagName);
}
}
};