|
@@ -34,27 +34,30 @@ class SearchBox extends React.Component {
|
|
|
// this.props.handleChangeValue('');
|
|
|
}
|
|
|
handleClearVal(){
|
|
|
- const { handleChangeValue } = this.props;
|
|
|
+ const { clearSearch } = this.props;
|
|
|
this.textInput.current.value = '';
|
|
|
this.textInput.current.focus();
|
|
|
this.setState({
|
|
|
val:'',
|
|
|
show:false
|
|
|
});
|
|
|
- handleChangeValue('');
|
|
|
+ clearSearch&&clearSearch();
|
|
|
}
|
|
|
handleSearchSelect(e,item){
|
|
|
e.stopPropagation();
|
|
|
e.preventDefault();
|
|
|
- const {cliIndex,chooseSearch,clearSearch} = this.props;
|
|
|
- console.log("选择数据:",item);
|
|
|
- this.setState({
|
|
|
+ const {cliIndex,chooseSearch,clearSearch,onSelect} = this.props;
|
|
|
+ onSelect();//上一级的“确定”
|
|
|
+ /*this.setState({
|
|
|
val:'',
|
|
|
show:false
|
|
|
- });
|
|
|
- chooseSearch&&chooseSearch({item:item,index:cliIndex})
|
|
|
+ });*/
|
|
|
+ setTimeout(()=>{
|
|
|
+ chooseSearch&&chooseSearch({item:item,index:cliIndex})
|
|
|
+ },200)
|
|
|
+
|
|
|
clearSearch&&clearSearch();
|
|
|
- this.textInput.current.innerText = "";
|
|
|
+ this.textInput.current.value = "";
|
|
|
}
|
|
|
handleInput(e){
|
|
|
e.stopPropagation();
|
|
@@ -104,7 +107,7 @@ class SearchBox extends React.Component {
|
|
|
const { clearSearch } = this.props;
|
|
|
if(!next.show && next.show != this.props.show){
|
|
|
clearSearch();
|
|
|
- this.textInput.current.innerText = "";
|
|
|
+ this.textInput.current.value = "";
|
|
|
this.setState({
|
|
|
showBox:false,
|
|
|
val:'',
|
|
@@ -129,7 +132,7 @@ class SearchBox extends React.Component {
|
|
|
background:'#f1f1f1'};
|
|
|
const barStyle={background:'#777',width:'100%'};
|
|
|
return (
|
|
|
- <div className={classNames(styles['search'])} onClick={(e)=>{e.stopPropagation();}}>
|
|
|
+ <div className={classNames(styles['search'])} onClick={(e)=>{e.stopPropagation();}} onBlur={(e)=>{e.stopPropagation();}}>
|
|
|
<img className={styles.searchVal} src={search} alt="搜索" onClick={this.clickIcon}/>
|
|
|
<img style={{display:show?'block':'none'}} className={styles.clearVal} src={clear} onClick={this.handleClearVal} alt="清空" />
|
|
|
<input
|