king
2021-11-17 c51f5e007a3e03c9d6731ab7f28f0080de009990
src/components/mkIcon/index.jsx
@@ -13,7 +13,8 @@
  state = {
    selectIcon: '',
    icons: [...minkeIconSystem.normal, ...minkeIconSystem.trademark, ...minkeIconSystem.data, ...minkeIconSystem.edit, ...minkeIconSystem.hint, ...minkeIconSystem.direction],
    allowClear: false,
    icons: [...minkeIconSystem.direction, ...minkeIconSystem.edit, ...minkeIconSystem.normal, ...minkeIconSystem.trademark, ...minkeIconSystem.data, ...minkeIconSystem.hint],
    visible: false
  }
@@ -22,7 +23,8 @@
    if (this.props['data-__meta']) {
      val = this.props['data-__meta'].initialValue || ''
    }
    this.setState({selectIcon: val})
    this.setState({selectIcon: val, allowClear: this.props.allowClear === true})
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -35,12 +37,13 @@
  }
  render() {
    const { selectIcon, visible, icons } = this.state
    const { selectIcon, visible, icons, allowClear } = this.state
    return (
      <div className="mk-icon-box">
        {selectIcon ? <Icon type={selectIcon}/> : null}
        <Icon onClick={() => this.setState({visible: true})} type="appstore"/>
        {selectIcon ? <Icon type={selectIcon}/> : <Icon style={{opacity: 0}} type="plus"/>}
        <Icon className="trigger" onClick={() => this.setState({visible: true})} type="swap"/>
        {allowClear && selectIcon ? <Icon className="close" onClick={() => this.checkIcon('')} theme="filled" type="close-circle"/> : null}
        <Modal
          wrapClassName="popview-modal mk-icon-wrap"
          title={'图标选择'}