Commit 327dabad by zhanghaozhe

通用弹框组件bug

parent 478e61b3
...@@ -6,7 +6,8 @@ import propTypes from 'prop-types' ...@@ -6,7 +6,8 @@ import propTypes from 'prop-types'
class ClosablePopup extends Component { class ClosablePopup extends Component {
state = { state = {
visible: this.props.visible visible: this.props.visible,
close: this.props.close
} }
close = () => { close = () => {
...@@ -14,9 +15,9 @@ class ClosablePopup extends Component { ...@@ -14,9 +15,9 @@ class ClosablePopup extends Component {
close ? close() : this.setState({visible: false}) close ? close() : this.setState({visible: false})
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps, prevState) {
const {visible} = this.props const {visible} = this.props
if (prevProps.visible !== visible) { if (prevState.visible !== this.props.visible) {
this.setState({ this.setState({
visible 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