input 实现table表格过滤查询,两个参数

  
          
            
          
     
        

const tableAllData = ref();
const queryForm = ref({
  searcVal: '',
})
// table表格过滤后数据两个参数
const tableListData = computed(() => {
  if (!queryForm.value.searcVal) {
    getTableList()
    return tableData.value;
  }
  const searchNewValuesValue = queryForm.value.searcVal.toLowerCase()
  return tableAllData.value.filter((item: any) => item.fullName.toLowerCase().includes(searchNewValuesValue) || item.methodName.toLowerCase().includes(searchNewValuesValue)
  );
})
//初始化数据
const getTableList = async () => {
  const res = await TM.API.GetAPIMethodInfoList()
  tableAllData.value = res
}

实现逻辑:获取初始化table表格,将后端数据赋值给定义的数组变量,最后定义表格变量(实现过滤查询)

你可能感兴趣的:(java,前端,javascript)