king
2022-12-08 a29edbd4c670e1907e38e98f20257e5519745a4d
src/components/mkIcon/index.jsx
@@ -89,13 +89,26 @@
    })
  }
  trigger = () => {
    const { selectIcon, cusicons } = this.state
    this.setState({visible: true})
    if (cusicons.length > 0 && selectIcon && /<svg/.test(selectIcon)) {
      setTimeout(() => {
        let node = document.getElementById('mk-custom-tab')
        node && node.click()
      }, 200)
    }
  }
  render() {
    const { selectIcon, visible, icons, allowClear, cusicons } = this.state
    return (
      <div className="mk-icon-box">
        {selectIcon ? <MkIcon type={selectIcon}/> : <span style={{color: '#bcbcbc'}}>请选择</span>}
        <MkIcon className="trigger" onClick={() => this.setState({visible: true})} type="swap"/>
        <MkIcon className="trigger" onClick={this.trigger} type="swap"/>
        {allowClear && selectIcon ? <CloseCircleFilled className="close" onClick={() => this.checkIcon('')}/> : null}
        <Modal
          wrapClassName="mk-pop-modal mk-icon-wrap"
@@ -118,13 +131,13 @@
              </Row>
            </TabPane>
            <TabPane tab={
              <span className="tab-control">
              <span className="tab-control" id="mk-custom-tab">
                <RedoOutlined onClick={(e) => {this.getIcons()}}/>
                自定义
              </span>
            } key="scripts">
              <Row>
                {cusicons.map(icon => <Col key={icon.id} span={4} onClick={() => this.checkIcon(icon.icon_svg)}>
                {cusicons.map(icon => <Col className={icon.icon_svg === selectIcon ? 'active' : ''} key={icon.id} span={4} onClick={() => this.checkIcon(icon.icon_svg)}>
                  <MkIcon type={icon.icon_svg} />
                </Col>)}
              </Row>