<Search placeholder="使用IP地址搜索" value={this.props.fitValue} onChange={this.props.onChange} className={styles.search} />
绑定事件
onChange = (e) => {
this.setState({
fitValue: e.target.value
});
}
过滤方法
filterList = (list, filter) => {
function trim(value) {
if (value && typeof value === ‘string’) {
return value.replace(/^\s+|\s+$/g, ‘’);
}
}
let value = trim(filter)
if (!value) return list
return list.filter((item) => item.externalDomain.includes(value))
}
antd 中桌面的方法
<Table size=“small” className=‘departmentList’ bordered={false} columns={this.applicationColumns} dataSource={this.filterList(applicationData, fitValue)} />