Comparing version 0.0.20 to 0.0.21
@@ -44,2 +44,23 @@ import React from 'react'; | ||
componentDidMount() { | ||
this.clickEvt = this.click.bind(this); | ||
window.addEventListener('click', this.clickEvt); | ||
} | ||
componentWillUnmount() { | ||
window.removeEventListener('click', this.clickEvt); | ||
} | ||
click(e) { | ||
let target = e.target; | ||
while (target) { | ||
if (target === this.popDom || target === this.popHandleDom) { | ||
return false; | ||
} | ||
target = target.parentElement; | ||
} | ||
this.setState({ | ||
ctiyBoxShow: false | ||
}); | ||
} | ||
render() { | ||
@@ -52,3 +73,3 @@ // listShow | ||
return ( | ||
<div className="hui-option" style={this.props.style || {}}> | ||
<div className={`${this.props.className} hui-option`} style={this.props.style || {}} ref={e => this.popDom = e}> | ||
<div className="hui-option-box" | ||
@@ -67,3 +88,3 @@ onClick={this.toggleList.bind(this)} | ||
<ul className="hui-option-list-shadow" style={shadowStyle}>{this.getList()}</ul> | ||
</div> | ||
</div > | ||
) | ||
@@ -70,0 +91,0 @@ } |
{ | ||
"name": "hui-ui", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "hui-ui", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
162728
468