因为官方没有给出这个x的点击事件的监听hook,因此只能本身曲线救过。spa
根据文档说明:code
onSearchThe callback function triggered when you click on the search-icon, the clear-icon or press the Enter key对象
能够了解到onSearch的触发条件。blog
而后经过event对象进行触发类型的判断。事件
onSearch = (value, event) => { if (event.nativeEvent.type === 'click' && value === '') { // listen click setTimeout(() => { // TODO }, 300); } if (event.nativeEvent.type === 'enter' && value === '') { // Enter setTimeout(() => { // TODO }, 300); } if (value === '') { return; } // search };