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/menu/components/form/formaction/index.jsx |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx
index 2227f2a..10b6797 100644
--- a/src/menu/components/form/formaction/index.jsx
+++ b/src/menu/components/form/formaction/index.jsx
@@ -32,10 +32,6 @@
     profVisible: false,  // 楠岃瘉淇℃伅缂栬緫
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
-  }
-
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.props.group), fromJS(nextProps.group)) || !is(fromJS(this.state), fromJS(nextState))
   }
@@ -47,12 +43,9 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
   }
 
   handleStyle = (element) => {
-    const { group } = this.props
-
     let _style = element.style ? fromJS(element.style).toJS() : {}
     let options = ['font', 'border', 'padding', 'margin', 'backgroundColor', 'width']
 
@@ -60,19 +53,18 @@
       card: element
     })
 
-    MKEmitter.emit('changeStyle', [group.uuid, element.type], options, _style)
+    MKEmitter.emit('changeStyle', options, _style, this.getStyle)
   }
 
-  getStyle = (comIds, style) => {
+  getStyle = (style) => {
+    const { card } = this.state
     let group = fromJS(this.props.group).toJS()
 
-    if (comIds.length !== 2 || comIds[0] !== group.uuid) return
-
-    if (comIds[1] === 'prev') {
+    if (card.type === 'prev') {
       group.prevButton.style = style
-    } else if (comIds[1] === 'submit') {
+    } else if (card.type === 'submit') {
       group.subButton.style = style
-    } else if (comIds[1] === 'next') {
+    } else if (card.type === 'next') {
       group.nextButton.style = style
     }
 

--
Gitblit v1.8.0