From 89f85223ff7b1b5ee3931ae01efa3dd17d5524fc Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:03:27 +0800 Subject: [PATCH] Merge branch 'develop' --- src/components/encrypts/index.jsx | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/components/encrypts/index.jsx b/src/components/encrypts/index.jsx index 8d6617d..7ed752e 100644 --- a/src/components/encrypts/index.jsx +++ b/src/components/encrypts/index.jsx @@ -13,6 +13,12 @@ eye: false } + UNSAFE_componentWillReceiveProps(nextProps) { + if (nextProps.value !== this.props.value) { + this.setState({eye: false}) + } + } + getValue = () => { const { value } = this.props @@ -44,7 +50,7 @@ return ( <> {eye ? value : this.getValue()} - {eye ? <EyeOutlined className="mk-open-eye" onClick={() => this.setState({eye: false})}/> : <EyeInvisibleOutlined className="mk-close-eye" onClick={() => this.setState({eye: true})}/>} + {eye ? <EyeOutlined className="mk-open-eye" onClick={(e) => {e.stopPropagation();this.setState({eye: false})}}/> : <EyeInvisibleOutlined className="mk-close-eye" onClick={(e) => {e.stopPropagation();this.setState({eye: true})}}/>} </> ) } -- Gitblit v1.8.0