From e0e5aa28cbd509579c7a83672a93241c9a5ed7e9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 06 七月 2020 15:09:49 +0800
Subject: [PATCH] 2020-07-06

---
 src/views/mobdesign/index.jsx |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx
index 22748d1..5a2f0b8 100644
--- a/src/views/mobdesign/index.jsx
+++ b/src/views/mobdesign/index.jsx
@@ -125,6 +125,22 @@
     })
   }
 
+  updateStyle = (proper) => {
+    const { config } = this.state
+
+    config.components = config.components.map(component => {
+      if (component.uuid === proper.componentId) {
+        Object.keys(component).forEach(key => {
+          if (component[key].editable && component[key].uuid === proper.uuid) {
+            component[key].style = {...component[key].style, ...proper.style}
+          }
+        })
+      }
+      return component
+    })
+    this.setState({config})
+  }
+
   updateConfig = (config) => {
     this.setState({
       config: config
@@ -162,10 +178,10 @@
               </div> : null
             }
             <div className="mob-setting">
-              {config ? <Tabs defaultActiveKey="2" animated={false} size="small">
+              {config ? <Tabs defaultActiveKey="1" animated={false} size="small">
                 <TabPane tab="閰嶇疆" key="1">
                   {/* <SketchPicker /> */}
-                  <Controller editElem={editElem} />
+                  <Controller editElem={editElem} updateStyle={this.updateStyle} />
                 </TabPane>
                 <TabPane tab="鏁版嵁婧�" key="2">
                   <DataSource config={config} updateConfig={this.updateConfig} />

--
Gitblit v1.8.0