F
F
fessss2020-07-27 11:51:14
Vue.js
fessss, 2020-07-27 11:51:14

Filtering on vue js?

Hello, I've been struggling for an hour, I don't understand how to do it.

There is a field for filtering:

<input type="text" v-model="searchList" placeholder="Выберите фильтр" />


computed: {
  	listFilter() {
      return this.filter1.filter(item => item.indexOf(this.searchList) !== -1)
    },
  	filter1(){
    	return ['bmw', 'audi', 'ford']
    },
    filter2(){
    	return [2017, 2018, 2019]
    },
    filter3(){
    	return ['седан', 'купе', 'хетчбек']
    }
  },


How can filters be combined?
So that the filter was first by brand, then by year, and then by type?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2020-07-27
@fessss

[...this.filter1(),...this.filter2(),...this.filter3()].filter()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question