From badd84cc656409590040caaad63bf22f0b6afaf1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 14 七月 2021 18:09:25 +0800
Subject: [PATCH] 2021-07-14

---
 src/menu/components/share/styleInput/index.jsx |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/menu/components/share/styleInput/index.jsx b/src/menu/components/share/styleInput/index.jsx
index ed08461..361265b 100644
--- a/src/menu/components/share/styleInput/index.jsx
+++ b/src/menu/components/share/styleInput/index.jsx
@@ -53,7 +53,7 @@
   }
 
   UNSAFE_componentWillReceiveProps(nextProps) {
-    if (!nextProps.value && this.state.value !== '') {
+    if (nextProps.value === '' && this.state.value !== '') {
       this.setState({value: ''})
     } else if (nextProps.value && nextProps.value !== `${this.state.value}${this.state.unit}`) {
       let val = nextProps.value
@@ -76,7 +76,6 @@
       if (isNaN(_val)) {
         _val = ''
       }
-
       this.setState({value: _val, unit})
     }
   }
@@ -109,7 +108,7 @@
     this.setState({
       value: _val,
     }, () => {
-      this.props.onChange(_val ? `${_val}${unit}` : '')
+      this.props.onChange(_val !== '' ? `${_val}${unit}` : '')
     })
   }
 
@@ -117,7 +116,7 @@
     const { value } = this.state
 
     this.setState({unit: val}, () => {
-      this.props.onChange(value ? `${value}${val}` : '')
+      this.props.onChange(value !== '' ? `${value}${val}` : '')
     })
   }
 

--
Gitblit v1.8.0