From 1a08525fe39ea67325725c75dcf0397b9fdb710f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 03 六月 2021 16:57:13 +0800
Subject: [PATCH] 2021-06-03

---
 src/components/mkIcon/index.jsx |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/components/mkIcon/index.jsx b/src/components/mkIcon/index.jsx
index ba860be..8d7d560 100644
--- a/src/components/mkIcon/index.jsx
+++ b/src/components/mkIcon/index.jsx
@@ -13,6 +13,7 @@
 
   state = {
     selectIcon: '',
+    allowClear: false,
     icons: [...minkeIconSystem.normal, ...minkeIconSystem.trademark, ...minkeIconSystem.data, ...minkeIconSystem.edit, ...minkeIconSystem.hint, ...minkeIconSystem.direction],
     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 ? <Icon className="close" onClick={() => this.checkIcon('')} type="close"/> : null}
         <Modal
           wrapClassName="popview-modal mk-icon-wrap"
           title={'鍥炬爣閫夋嫨'}

--
Gitblit v1.8.0