From 5df578ff69f6b02e821d59a8883bc75d78695a62 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 10 十一月 2020 11:07:31 +0800
Subject: [PATCH] 2020-11-10

---
 src/menu/modelsource/index.jsx |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/menu/modelsource/index.jsx b/src/menu/modelsource/index.jsx
index 7eb339f..91f4c24 100644
--- a/src/menu/modelsource/index.jsx
+++ b/src/menu/modelsource/index.jsx
@@ -5,12 +5,29 @@
 import SourceWrap from './dragsource'
 import './index.scss'
 
-class CardChart extends Component {
+class ModelSource extends Component {
+  state = {
+    menuOptions: null
+  }
+
+  UNSAFE_componentWillMount () {
+    const { MenuType } = this.props
+    let options = fromJS(menuOptions).toJS()
+
+    options = options.filter(item => !item.forbid || !item.forbid.includes(MenuType))
+
+    this.setState({
+      menuOptions: options
+    })
+  }
+
   shouldComponentUpdate (nextProps, nextState) {
-    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
+    return !is(fromJS(this.state), fromJS(nextState))
   }
 
   render() {
+    const { menuOptions } = this.state
+
     return (
       <div className="mob-card-source-box">
         {menuOptions.map((item, index) => (<SourceWrap key={index} content={item} />))}
@@ -19,4 +36,4 @@
   }
 }
 
-export default CardChart
\ No newline at end of file
+export default ModelSource
\ No newline at end of file

--
Gitblit v1.8.0