|
@@ -8,6 +8,7 @@ class ScaleSearch extends Component {
|
|
|
super(props);
|
|
|
this.$inp = React.createRef();
|
|
|
this.$cont = React.createRef();
|
|
|
+ this.$ul = React.createRef();
|
|
|
this.state={
|
|
|
val:'',
|
|
|
hasSearch: false,
|
|
@@ -37,6 +38,12 @@ class ScaleSearch extends Component {
|
|
|
}
|
|
|
getSearchList() {
|
|
|
const { searchResult } = this.props;
|
|
|
+ const that = this;console.log(getWindowInnerHeight()-270);
|
|
|
+ if(searchResult&&searchResult.length>0){
|
|
|
+ setTimeout(function(){
|
|
|
+ that.$ul.current.style.height = getWindowInnerHeight()-270+'px';
|
|
|
+ },200);
|
|
|
+ }
|
|
|
return searchResult && searchResult.map((item) => {
|
|
|
return <li key={item.conceptId}
|
|
|
title='点击查看详情'
|
|
@@ -96,6 +103,10 @@ class ScaleSearch extends Component {
|
|
|
const height = getWindowInnerHeight()-170;
|
|
|
this.$cont.current.style.height = height+"px";
|
|
|
}
|
|
|
+ if(this.$ul.current){
|
|
|
+ const height = getWindowInnerHeight()-270;
|
|
|
+ this.$ul.current.style.height = height+"px";
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
componentWillReceiveProps(){
|
|
@@ -118,7 +129,7 @@ class ScaleSearch extends Component {
|
|
|
</div>
|
|
|
{searchResult&&searchResult.length>0?<div className={style['result']}>
|
|
|
<p className={style['title']}>查询内容</p>
|
|
|
- <ul>
|
|
|
+ <ul ref={this.$ul}>
|
|
|
{this.getSearchList()}
|
|
|
</ul>
|
|
|
</div>:<p className={style['no-data']}>{hasSearch?'搜索中...':msg}</p>}
|