From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18

---
 src/components/mkIcon/index.jsx |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/components/mkIcon/index.jsx b/src/components/mkIcon/index.jsx
index ba860be..c1c7c13 100644
--- a/src/components/mkIcon/index.jsx
+++ b/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={'鍥炬爣閫夋嫨'}

--
Gitblit v1.8.0