From 9614778235fd3f957f319c09935b60b3bea2ce2c Mon Sep 17 00:00:00 2001 From: Apple <> Date: Tue, 27 Dec 2022 17:59:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BC=98=E5=8C=96filterBar=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/filterSelect/main.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/filterSelect/main.js b/src/components/filterSelect/main.js index f604f884..276ba58a 100644 --- a/src/components/filterSelect/main.js +++ b/src/components/filterSelect/main.js @@ -5,6 +5,7 @@ import _ from "lodash"; import Menu from "../menu/main.js"; export default class filterSelect extends React.Component { + constructor(props) { super(props); let menuList = _.map(props.data.menuList, (item) => { @@ -31,10 +32,7 @@ export default class filterSelect extends React.Component { this.setState({ menuShow: isShow }); } mouseLeaveFn(){ - window.document.addEventListener('click',()=>{ - this.setState({ menuShow:false}); - }); - + this.setState({ menuShow:false}); } mouseMenuFn(){ this.setState({ menuShow: true }); @@ -80,7 +78,11 @@ export default class filterSelect extends React.Component { }); this.setState({ menuList: menuList }); } - + componentDidMount(){ + window.document.addEventListener('click',()=>{ + this.setState({ menuShow:false}); + }); + } render() { return (