weui / react-weui

weui for react
https://weui.github.io/react-weui/docs/
2.85k stars 492 forks source link

SearchBar组件无法通过value设置内容值 #240

Open zhj135 opened 7 years ago

zhj135 commented 7 years ago

Do you want to request a feature or report a bug (建议还是bug) ? bug What is the current behavior? (现有状况) <SearchBar onChange={this.handleChange.bind(this)} onSubmit={this.handleSearch.bind(this)} placeholder="输入书名" value={this.state.value} lang={{ cancel: '取消' }} /> SearchBar中的文字(组件中的state.text)无法通过业务代码中的value值改变 What is the expected behavior? (应有状况) SearchBar组件中增加componentWillReceiveProps,如: componentWillReceiveProps(nextProps) { if (nextProps.value !== this.props.value) { this.setState({ text: nextProps.value }); } } Which versions of React-weui, weui, and which OS and device are affected by this issue? (React-weui版本 weui版本 机型和系统) 当前的master分支,1.0.3