Search a list while typing in textbox VueJS 2

后端 未结 6 1296
我寻月下人不归
我寻月下人不归 2021-02-04 15:00

I have a list of users from an array. And I want to filter them based on the search box(name) at the top. I saw that there are filters in VueJS 1. But not available in VuesJS 2.

6条回答
  •  庸人自扰
    2021-02-04 15:45

    This method worked good for me

    computed: {
       filteredList() {
         return this.postList.filter(post => {
           var vm = this;
           return post.title.toLowerCase().includes(vm.search.toLowerCase())
         })
       }
    }
    

提交回复
热议问题