updpdate keyup search

This commit is contained in:
dengtongyu committed 2018-05-30 11:42:57 +08:00
1 parent 933d93ccba
commit 99484e359e
3 files changed
+15 -5

No files matched your search

+12 -2
View File
@@ -11,7 +11,7 @@ class SearchBar extends Component {
value:''
}
onClickBtn = () => {
searchKeyword = () => {
if(this.state.value) {
DataStore.keyword = this.state.value;
DataStore.page = 1;
@@ -23,6 +23,16 @@ class SearchBar extends Component {
}
}
onClickBtn = (event) => {
this.searchKeyword();
}
onKeyUp = (event) => {
if(event.keyCode === 13 || event.keyCode === 108) {
this.searchKeyword();
}
}
onTextChange = (event) => {
this.setState({
value: event.target.value
@@ -35,7 +45,7 @@ class SearchBar extends Component {
<div className="search-input">
<input type="text" placeholder="搜索歌曲或歌手"
value={this.state.value}
onChange={this.onTextChange} />
onChange={this.onTextChange} onKeyUp={this.onKeyUp} />
</div>
<div className="search-btn">
<button className="iconfont icon-search"
+1 -1
View File
@@ -49,7 +49,7 @@ class SongList extends Component {
if(DataStore.listType === 0 && list.length >= DataStore.pageSize) {
listItems.push(
<div className="more-box">
<div className="more-box" key={'morebutton'}>
<a onClick={this.onClickMore}>点击加载更多</a>
</div>
);