fix:优化filterBar组件,点击document关闭状态菜单悬浮框

This commit is contained in:
Apple 2022-12-27 17:03:47 +08:00
parent c69a2a5b7f
commit 4c6765925b
1 changed files with 5 additions and 2 deletions

View File

@ -31,7 +31,10 @@ export default class filterSelect extends React.Component {
this.setState({ menuShow: isShow });
}
mouseLeaveFn(){
this.setState({ menuShow: false });
window.document.addEventListener('click',()=>{
this.setState({ menuShow:false});
});
}
mouseMenuFn(){
this.setState({ menuShow: true });
@ -88,7 +91,7 @@ export default class filterSelect extends React.Component {
this.onHandlerClick();
}}
onMouseEnter={()=>this.mouseMenuFn()}
// onMouseLeave={()=>this.mouseLeaveFn()}
onMouseLeave={()=>this.mouseLeaveFn()}
>
<span className="filter-label">{this.state.label}</span>
<span className="filter-maohao">:</span>