el-table模糊搜索

computed: {
     // 根据ip或盒子名称进行搜索
     getSearchInfo() {
      let search = this.search
      if (search) {
       this.currpage = 1
       this.currentPage = 1
       return this.tableData.filter((data) => {
        return Object.keys(data).some((key) => {
          if(typeof data[key] == 'string'){
            return data[key].toLowerCase().indexOf(search.toLowerCase()) > -1
          }
          if (typeof data[key] == 'number') {
            return data[key].toString().includes(search)
          }
        })
       })
      }
      return this.tableData
     },
    },

 

posted @ 2023-05-12 16:46  yw3692582  阅读(28)  评论(0编辑  收藏  举报