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/simple-form/index.jsx | 26 +++----------------------- 1 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index f09614f..e1c5299 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -112,7 +112,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -127,7 +126,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -221,29 +219,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] === 'form') { - let Index = card.subcards[0].fields.findIndex(n => n.uuid === comIds[1]) - - if (Index === -1) return - - let _card = fromJS(card).toJS() - - _card.subcards[0].fields[Index].style = style - - this.updateComponent(_card) - - return - } - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } -- Gitblit v1.8.0