Я получил фильтр в VUE.
Шаблон:
<b-button v-if="filterFilled()" @click="clearFilter">
Clear
</b-button>
Данные:
data () {
return {
filter: {
price_from: '',
price_to: '',
surface_from: '',
surface_to: '',
floor: '',
type: '',
structure: '',
},
}
},
И мой метод, где я проверяю, является грязным фильтром:
filterFilled(){
return (this.filter.price_from || this.filter.price_to || this.filter.surface_to || this.filter.surface_from ||
this.filter.floor || this.filter.type || this.filter.structure)
},
Это прекрасно работает, но мой вопрос: существует ли лучший способ узнать, заполнил ли объект реквизит?