x-extends/vxe-table-docs

过滤案例有问题 FilterInput

imp-oh opened this issue · 0 comments

错误示例地址 https://github.com/x-extends/vxe-table-docs/blob/main/v3/src/plugins/table/renderer/filter.tsx

// 创建一个简单的输入框筛选
VXETable.renderer.add('FilterInput', {
// 筛选模板
renderFilter (h, renderOpts, params) {
return
},
// 重置数据方法
filterResetMethod ({ options }) {
options.forEach(option => {
option.data = ''
})
},
// 重置筛选复原方法(当未点击确认时,该选项将被恢复为默认值)
filterRecoverMethod ({ option }) {
option.data = ''
},
// 筛选方法
filterMethod ({ option, row, column }) {
const { data } = option
// 这里如果是 number 类型匹配错误,示例可以更正一下
const cellValue = (typeof row[column.field]) === 'number' ? ${row[column.field]} : row[column.field]
if (cellValue) {
return cellValue.indexOf(data) > -1
}
return false
}
})