king
2023-05-10 08a5117afa248c8dbd398c82d7b9edd8d4b6d8aa
src/menu/components/code/sandbox/codecontent/index.jsx
@@ -27,10 +27,13 @@
  componentDidMount () {
    const { config } = this.props
    if (config.js && config.wrap.compileMode !== 'custom') {
    if (config.js) {
      try {
        // eslint-disable-next-line no-eval
        eval(config.js)
        // eval(config.js)
        // eslint-disable-next-line
        let evalfunc = eval('(true && function (data) {' + config.js + '})')
        evalfunc([])
      } catch (e) {
        message.warning(config.name + 'JS 执行失败!')
        console.warn(config.name + e)
@@ -53,10 +56,11 @@
      }
    }
    if (config.html !== nextProps.config.html || config.js !== nextProps.config.js) {
      if (nextProps.config.js && nextProps.config.wrap.compileMode !== 'custom') {
      if (nextProps.config.js) {
        try {
          // eslint-disable-next-line no-eval
          eval(nextProps.config.js)
          let evalfunc = eval('(true && function (data) {' + nextProps.config.js + '})')
          evalfunc([])
        } catch (e) {
          message.warning(config.name + 'JS 执行失败!')
          console.warn(config.name + e)