UNPKG

zent

Version:

一套前端设计语言和基于React的实现

40 lines (34 loc) 662 B
--- order: 2 zh-CN: title: 搜索 en-US: title: Search --- ```js import { useState, useCallback } from 'react'; import { Transfer } from 'zent'; const data = new Array(20) .fill() .map((_, index) => ({ option: String(index), text: `option${index}` })); const columns = [ { name: 'text', }, ]; const [targetKeys, setTargetKeys] = useState([]); ReactDOM.render( <div> <Transfer keyName="option" dataSource={data} targetKeys={targetKeys} onChange={({ targetKeys }) => setTargetKeys(targetKeys)} showSearch filterOption={(inputValue, { text }) => text.indexOf(inputValue) > -1} list={{ columns }} /> </div>, mountNode ); ```