react-weui icon indicating copy to clipboard operation
react-weui copied to clipboard

关于 SearchBar 组件 value 绑定以及手机端修改回车键盘的建议

Open neoyoun opened this issue 8 years ago • 0 comments

1、目前 SearchBarinput 没有被识别成搜索框,手机浏览器激活输入框时,键盘回车键显示的是 'return‘(IOS自带键盘、'换行'(讯飞输入法 IOS 版)。原因在于 SearchBar 的 form 中没有 action 属性。增加后可以解决。 2、输入框的值不能保持绑定,常见的场景是路由跳转后再返回,激活输入框时,值为空( store 里有值),我对 SearchBar 增加了一个 bindValue 的 props 值,修改 input 的 onFocus 方法后可以解决,但是不确定合不合理。 原代码: <input onFocus={e=>this.setState({focus:true})} /> 修改后为 <input onFocus={this.focusHandle.bind(this)} />

focusHandle(e) { this.setState({focus:true, text: this.props.bindValue}) } 并在 defaultProps 中增加 bindValue: '' 这是我的解决方法。

3、用新版本的 react 会一直有 PropTypes 弃用的 warning.

neoyoun avatar Jun 14 '17 04:06 neoyoun