import React , {Component} from 'react'; import { Cascader } from 'antd'; import CityData from './cityData'; class TestOne extends Component { onChange_cascader(value) { console.log(value); } filter_cascader = (inputValue, path) => { return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1); } render(){ return( <div> <div>1</div>
{/*可以直接搜索选项并选择 选择即改变*/} <Cascader options={CityData} onChange={this.onChange_cascader} changeOnSelect style={{300}} showSearch={ this.filter_cascader } /> </div> ) } } export default TestOne;