UNPKG

cjd-parkball

Version:

> 中后台业务组件库,中后台就像公园,进入需要买门票(登录),所以以 Parkball(公园球) 命名,公园内必定捕获!作为一个组件库,提供使用方法文档,方便开发者的调用

66 lines (53 loc) 1.13 kB
--- category: 2 title: 自定义输入组件 title_en: Customize Input Component --- zh-CN 自定义输入组件。 en-US Customize Input Component ````jsx import { AutoComplete } from 'parkball'; import { Input } from 'antd' const { TextArea } = Input; function onSelect(value) { console.log('onSelect', value); } class Complete extends React.Component { state = { dataSource: [], } handleSearch = (value) => { this.setState({ dataSource: !value ? [] : [ value, value + value, value + value + value, ], }); } handleKeyPress = (ev) => { console.log('handleKeyPress', ev); } render() { const { dataSource } = this.state; return ( <AutoComplete dataSource={dataSource} style={{ width: 200 }} onSelect={onSelect} onSearch={this.handleSearch} > <TextArea placeholder="input here" className="custom" style={{ height: 50 }} onKeyPress={this.handleKeyPress} /> </AutoComplete> ); } } ReactDOM.render(<Complete />, mountNode); ````