在搜索框中输入要查询的数据,并进行实时的查询

computed: {
            // 实时搜索数据展示
            filterList() {
                var arr = []
                this.caseList.forEach((value) => arr.push(value))
                if (this.keyword) {
                    arr = this.caseList.filter(value => value.EquipmentName.includes(this.keyword))
                }
                return arr
            }
        },
EquipmentName:是当前你要搜索字段的值
要把循环的数组换成实时搜索的数据名
<view v-for="(value,index) in filterList" :key="index" 
data() {
            return {
                keyword:'',        // 搜索
                caseList:[],    // 优秀案例
            }
        },

 

posted @ 2021-05-07 15:18  温柔本肉  阅读(480)  评论(0编辑  收藏  举报