king
2020-09-26 ab60d53b67f802878662aaa5a5b52580cca421b8
src/menu/components/card/cardcellcomponent/index.jsx
@@ -7,6 +7,7 @@
import enUS from '@/locales/en-US/model.js'
import { getCardCellForm } from './formconfig'
import MKEmitter from '@/utils/events.js'
import ElementForm from './elementform'
import DragElement from './dragaction'
import './index.scss'
@@ -38,20 +39,42 @@
    })
  }
  componentDidMount () {
    MKEmitter.addListener('cardAddElement', this.cardAddElement)
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props.config), fromJS(nextProps.config)) || !is(fromJS(this.state), fromJS(nextState))
  }
  /**
   * @description 按钮顺序调整,或拖拽添加
   * @description 组件销毁,清除state更新,清除快捷键设置
   */
  handleList = (list, card) => {
  componentWillUnmount () {
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('cardAddElement', this.cardAddElement)
  }
  cardAddElement = (cardId, element) => {
    if (cardId !== this.props.config.uuid) return
    const { elements } = this.state
    this.setState({elements: [...elements, element]})
    this.handleElement(element)
  }
  /**
   * @description 按钮顺序调整
   */
  handleList = (list) => {
    const { config } = this.props
    if (card) {
      this.setState({elements: list})
      this.handleElement(card)
    } else {
      this.setState({elements: list}, () => {
        this.props.updateElement({...config, elements: list})
      })
    }
    this.setState({elements: list}, () => {
      this.props.updateElement({...config, elements: list})
    })
  }
  /**
@@ -132,20 +155,6 @@
      },
      onCancel() {}
    })
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props.config), fromJS(nextProps.config)) || !is(fromJS(this.state), fromJS(nextState))
  }
  /**
   * @description 组件销毁,清除state更新
   */
  componentWillUnmount () {
    this.setState = () => {
      return
    }
  }
  render() {