Commit 327dabad by zhanghaozhe

通用弹框组件bug

parent 478e61b3
......@@ -6,7 +6,8 @@ import propTypes from 'prop-types'
class ClosablePopup extends Component {
state = {
visible: this.props.visible
visible: this.props.visible,
close: this.props.close
}
close = () => {
......@@ -14,9 +15,9 @@ class ClosablePopup extends Component {
close ? close() : this.setState({visible: false})
}
componentDidUpdate(prevProps) {
componentDidUpdate(prevProps, prevState) {
const {visible} = this.props
if (prevProps.visible !== visible) {
if (prevState.visible !== this.props.visible) {
this.setState({
visible
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment