Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

画布初始化时没有组件,直接修改js面板报错,导致画布渲染失败 #70

Closed
ChiZng opened this issue Jun 9, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ChiZng
Copy link

ChiZng commented Jun 9, 2023

复现方式

  1. 使用lowcode-engine-demo项目,将schema.json文件中改为下面这个配置(默认不带组件)
{
  "componentName": "Page",
  "id": "node_dockcviv8fo1",
  "props": {},
  "fileName": "主页",
  "state": {
    "text": {
      "type": "JSExpression",
      "value": "\"outer\""
    },
    "isShowDialog": {
      "type": "JSExpression",
      "value": "false"
    },
    "info": {
      "type": "JSExpression",
      "value": "{\n  info: \"\",\n  user: {\n    username: \"\",\n    password: \"\"\n  }\n}"
    }
  },
  "meta": {
    "router": "main",
    "level": 1,
    "pageType": "1"
  },
  "dataSource": {
    "list": [
      {
        "type": "fetch",
        "isInit": true,
        "options": {
          "params": {},
          "method": "GET",
          "isCors": true,
          "timeout": 5000,
          "headers": {},
          "uri": "mock/info.json"
        },
        "id": "info"
      },
      {
        "type": "fetch",
        "isInit": false,
        "options": {
          "params": {
            "username": {
              "type": "JSExpression",
              "value": "this.info.user.username"
            },
            "password": {
              "type": "JSExpression",
              "value": "this.info.user.password"
            }
          },
          "method": "POST",
          "isCors": true,
          "timeout": 5000,
          "headers": {
            "Auth": {
              "type": "JSExpression",
              "value": "this.text"
            },
            "Content-Type": "application/json"
          },
          "uri": "/api/user/login"
        },
        "id": "submit"
      }
    ]
  },
  "css": "body {\n  font-size: 12px;\n}\n\n.button {\n  width: 100px;\n  color: #ff00ff\n}",
  "lifeCycles": {
    "mounted": {
      "type": "JSFunction",
      "value": "function mounted() {\n  console.log('did mount');\n}"
    },
    "beforeMount": {
      "type": "JSFunction",
      "value": "function beforeMount() {\n  console.log('will unmount');\n}"
    }
  },
  "methods": {
    "testFunc": {
      "type": "JSFunction",
      "value": "function testFunc() {\n  console.log('test func');\n}"
    }
  },
  "originCode": "class LowcodeComponent extends Component {\n  state = {\n    \"text\": \"outer\",\n    \"isShowDialog\": false,\n    \"info\": {\n      \"info\": \"\",\n      \"user\": {\n        \"username\": \"\",\n        \"password\": \"\"\n      }\n    }\n  }\n  componentDidMount() {\n    console.log('did mount');\n  }\n  componentWillUnmount() {\n    console.log('will unmount');\n  }\n  testFunc() {\n    console.log('test func');\n  }\n  onClick() {\n    this.setState({\n      isShowDialog: true\n    })\n  }\n  closeDialog() {\n    this.setState({\n      isShowDialog: false\n    })\n  }\n\n\tonClick_new(){\n    this.$message.success('hhhhhh')\n\t}\n\n\tonSubmit(ev){\n    ev.preventDefault();\n    this.dataSourceMap.submit.load()\n\t}\n}",
  "hidden": false,
  "title": "",
  "isLocked": false,
  "condition": true,
  "conditionGroup": ""
}
  1. 启动项目后在浏览器中打开·源码面板·,随便修改内容。报错。然后就会画布中的插槽就会消失,控制台报错。

图片

image
2. 打开源码面板随便修改,例如将函数名由testFunc() 修改为testFunc2()
image
3. 保存 ,页面插槽消失控制台报错
image
image

@keuby keuby self-assigned this Jul 18, 2023
@keuby keuby added the bug Something isn't working label Jul 18, 2023
@keuby
Copy link
Contributor

keuby commented Oct 8, 2023

fixed in v1.6.0

@keuby keuby closed this as completed Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants