chore: make this.value a computed property again

This commit is contained in:
kolaente 2021-10-31 16:33:25 +01:00
parent 0d752c9d32
commit dc02c09f19
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -10,7 +10,6 @@
:class="{'is-open': visibleInternal}" :class="{'is-open': visibleInternal}"
class="filter-popup" class="filter-popup"
v-model="value" v-model="value"
@change="update"
ref="filters" ref="filters"
/> />
</template> </template>
@ -38,10 +37,17 @@ export default {
data() { data() {
return { return {
visibleInternal: false, visibleInternal: false,
value: null,
} }
}, },
computed: { computed: {
value: {
get() {
return this.modelValue
},
set(value) {
this.$emit('update:modelValue', value)
},
},
hasFilters() { hasFilters() {
// this.value also contains the page parameter which we don't want to include in filters // this.value also contains the page parameter which we don't want to include in filters
const {sort_by, order_by, filter_by, filter_value, filter_comparator, filter_concat, s} = this.value const {sort_by, order_by, filter_by, filter_value, filter_comparator, filter_concat, s} = this.value
@ -72,9 +78,6 @@ export default {
}, },
immediate: true, immediate: true,
}, },
value() {
this.update()
},
visible() { visible() {
this.visibleInternal = !this.visibleInternal this.visibleInternal = !this.visibleInternal
}, },
@ -92,9 +95,6 @@ export default {
clearFilters() { clearFilters() {
this.value = {...defaultParams()} this.value = {...defaultParams()}
}, },
update() {
this.$emit('update:modelValue', this.value)
},
}, },
} }
</script> </script>