From 7b01bec1609710729a868093ad69484ebea82d80 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 20 十月 2020 10:16:26 +0800
Subject: [PATCH] 2020-10-20

---
 src/mob/colorsketch/index.jsx |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/mob/colorsketch/index.jsx b/src/mob/colorsketch/index.jsx
index 4f588d8..69f0d19 100644
--- a/src/mob/colorsketch/index.jsx
+++ b/src/mob/colorsketch/index.jsx
@@ -19,7 +19,22 @@
     onChange: PropTypes.func
   }
   state = {
-    color: this.props.defaultValue || this.props.value,
+    color: '',
+  }
+
+  UNSAFE_componentWillMount () {
+    const { defaultValue, value } = this.props
+    let initVal = ''
+
+    if (this.props['data-__meta']) {
+      initVal = this.props['data-__meta'].initialValue
+    } else if (defaultValue) {
+      initVal = defaultValue
+    } else if (value) {
+      initVal = value
+    }
+    
+    this.setState({color: initVal})
   }
 
   handleChange = (color) => {

--
Gitblit v1.8.0