From 3b103caa6bfc9ed410e67156c3ca1785bf1cecc9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 19 八月 2022 01:15:31 +0800
Subject: [PATCH] 2022-08-19

---
 src/mob/components/tabs/antv-tabs/index.jsx |   40 +++++++++++++++++-----------------------
 1 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/src/mob/components/tabs/antv-tabs/index.jsx b/src/mob/components/tabs/antv-tabs/index.jsx
index 1ddf66c..3800c62 100644
--- a/src/mob/components/tabs/antv-tabs/index.jsx
+++ b/src/mob/components/tabs/antv-tabs/index.jsx
@@ -80,7 +80,6 @@
   }
 
   componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
     MKEmitter.addListener('submitSearch', this.getSearch)
     MKEmitter.addListener('tabsChange', this.handleTabsChange)
     MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
@@ -93,7 +92,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
     MKEmitter.removeListener('submitSearch', this.getSearch)
     MKEmitter.removeListener('tabsChange', this.handleTabsChange)
     MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
@@ -135,37 +133,33 @@
   changeStyle = () => {
     const { tabs } = this.state
 
-    MKEmitter.emit('changeStyle', [tabs.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style)
+    MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style, this.getStyle)
   }
 
   changeTabStyle = () => {
     const { tabs } = this.state
 
-    MKEmitter.emit('changeStyle', [tabs.uuid, 'tab'], ['font', 'padding'], tabs.tabStyle || {})
+    MKEmitter.emit('changeStyle', ['font', 'padding'], tabs.tabStyle || {}, this.getTabStyle)
   }
 
-  getStyle = (comIds, style) => {
-    const { tabs } = this.state
+  getStyle = (style) => {
+    let _card = {...this.state.tabs, style}
 
-    if (comIds[0] !== tabs.uuid) return
+    this.setState({
+      tabs: _card
+    })
+    
+    this.props.updateConfig(_card)
+  }
 
-    if (comIds.length === 1) {
-      let _card = {...tabs, style}
+  getTabStyle = (style) => {
+    let _card = {...this.state.tabs, tabStyle: style}
 
-      this.setState({
-        tabs: _card
-      })
-      
-      this.props.updateConfig(_card)
-    } else if (comIds[1] === 'tab') {
-      let _card = {...tabs, tabStyle: style}
-
-      this.setState({
-        tabs: _card
-      })
-      
-      this.props.updateConfig(_card)
-    }
+    this.setState({
+      tabs: _card
+    })
+    
+    this.props.updateConfig(_card)
   }
 
   handleTabsChange = (parentId) => {

--
Gitblit v1.8.0