From f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 07 四月 2021 23:25:29 +0800
Subject: [PATCH] 2021-04-07

---
 src/menu/components/code/sandbox/index.jsx |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/menu/components/code/sandbox/index.jsx b/src/menu/components/code/sandbox/index.jsx
index 705dfda..7e1fb66 100644
--- a/src/menu/components/code/sandbox/index.jsx
+++ b/src/menu/components/code/sandbox/index.jsx
@@ -1,6 +1,5 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
 import { Icon, Popover } from 'antd'
 
@@ -28,7 +27,7 @@
   }
 
   state = {
-    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     card: null,
     back: false
   }
@@ -56,7 +55,8 @@
         columns: [],
         scripts: [],
         html: '',
-        css: ''
+        css: '',
+        js: '',
       }
 
       if (card.config) {
@@ -67,6 +67,7 @@
         _card.style = config.style
         _card.html = config.html
         _card.css = config.css
+        _card.js = config.js
       }
       
       this.setState({
@@ -85,7 +86,7 @@
   }
 
   shouldComponentUpdate (nextProps, nextState) {
-    return !is(fromJS(this.state), fromJS(nextState)) || (!this.props.menu && nextProps.menu)
+    return !is(fromJS(this.state), fromJS(nextState))
   }
 
   /**
@@ -167,20 +168,10 @@
         } trigger="hover">
           <Icon type="tool" />
         </Popover>
-        <CodeContent html={card.html} css={card.css}/>
+        <CodeContent name={card.name} html={card.html} css={card.css} js={card.js}/>
       </div>
     )
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    menu: state.customMenu
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(CodeSandBox)
\ No newline at end of file
+export default CodeSandBox
\ No newline at end of file

--
Gitblit v1.8.0