Fixes selectbox not clearing from tag and updating state.

This commit is contained in:
Mateus Machado Luna 2019-10-23 09:38:43 -03:00
parent eab118e49b
commit 0a9648beca
1 changed files with 5 additions and 4 deletions

View File

@ -32,7 +32,8 @@
mixins: [filterTypeMixin, dynamicFilterTypeMixin],
data(){
return {
options: []
options: [],
selected: ''
}
},
watch: {
@ -71,11 +72,10 @@
if ( this.query && this.query.metaquery && Array.isArray( this.query.metaquery ) ) {
let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatumId );
if ( index >= 0){
if ( index >= 0) {
let metadata = this.query.metaquery[ index ];
if (this.selected != metadata.value) {
this.selected = metadata.value;
this.$emit('sendValuesToTags', { label: metadata.value, value: metadata.value })
}
} else {
this.selected = '';
@ -83,6 +83,8 @@
} else {
this.selected = '';
}
this.$emit('sendValuesToTags', { label: this.selected, value: this.selected })
},
onSelect(value) {
this.$emit('input', {
@ -91,7 +93,6 @@
collection_id: this.collectionId,
value: value
});
this.$emit('sendValuesToTags', { label: value, value: value })
this.updateSelectedValues();
}