Ashraam
2 years ago
6
0
Vue

filter computed data from multiple source

Posted 2 years ago by Ashraam

Hi everyone,

I'm learning VueJS and I've got a little problem.

I'm getting a list of users with vue-resource and I put then in the users variable.

I've a name field where I can filter them by name like this

filteredUsers() {
            let filteredUsers = this.users;

            if(this.filter.name.length > 1) {
                filteredUsers =  filteredUsers.filter(item => {
                    if(item.name.toLowerCase().includes(this.filter.name.toLowerCase())) {
                        return true;
                    }
                    return false;
                });
            }

Now I'd like to add one or more filter from select box like (account type, etc) I don't find a solution. I tried to add a if statement but it doesn't seems to work.

How would you do that ?

Thanks

Please sign in or create an account to participate in this conversation.