|
@@ -14,6 +14,7 @@ class ScaleSearch extends Component {
|
|
|
this.search = this.search.bind(this);
|
|
|
this.handleChange = this.handleChange.bind(this);
|
|
|
this.clear = this.clear.bind(this);
|
|
|
+ this.handleEnter = this.handleEnter.bind(this);
|
|
|
}
|
|
|
getResult(id){
|
|
|
const {formulaResult} = this.props;
|
|
@@ -51,6 +52,11 @@ class ScaleSearch extends Component {
|
|
|
val:this.$inp.current.value
|
|
|
});
|
|
|
}
|
|
|
+ handleEnter(e){
|
|
|
+ if(e.keyCode==13){
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
+ }
|
|
|
clear(){
|
|
|
this.$inp.current.value = '';
|
|
|
this.setState({
|
|
@@ -71,14 +77,15 @@ class ScaleSearch extends Component {
|
|
|
const {searchResult} = this.props;
|
|
|
const {val} = this.state;
|
|
|
return (
|
|
|
- <div className={style['mefical-info-wrapper']} ref={this.$cont}>
|
|
|
- <div className={style['search-cont']}>
|
|
|
- <p className={style['title']}>量表搜索</p>
|
|
|
- <p className={style['cont']}>
|
|
|
- <input type="text" className={style['input']} ref={this.$inp} onInput={this.handleChange}/>
|
|
|
- {val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
|
|
|
- <button onClick={this.search}>搜索</button>
|
|
|
- </p>
|
|
|
+ <div className={style['search-cont']} ref={this.$cont}>
|
|
|
+ <div className={style['search-box']}>
|
|
|
+ <p className={style['title']}>量表搜索</p>
|
|
|
+ <p className={style['cont']}>
|
|
|
+ <input type="text" className={style['input']} ref={this.$inp} onInput={this.handleChange} onKeyUp={this.handleEnter}/>
|
|
|
+ {val?<img src={delIcon} alt="清空" onClick={this.clear}/>:''}
|
|
|
+ <button onClick={this.search}>搜索</button>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
{searchResult&&searchResult.length>0?<div className={style['result']}>
|
|
|
<p className={style['title']}>查询内容</p>
|
|
|
<ul>
|
|
@@ -86,8 +93,6 @@ class ScaleSearch extends Component {
|
|
|
</ul>
|
|
|
</div>:<p className={style['no-data']}>暂无搜索结果!</p>}
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
)
|
|
|
|
|
|
|