baidu/amis

amis-editor-demo本地安装运行错误

Opened this issue · 0 comments

1.按照步骤安装运行
https://github.com/aisuda/amis-editor-demo

{
 "name": "amis-editor-demo",
  "version": "1.0.0",
  "description": "amis 可视化编辑器",
"dependencies": {
    "@fortawesome/fontawesome-free": "^5.15.3",
    "amis": "^6.0.0",
    "amis-core": "^6.0.0",
    "amis-formula": "^6.0.0",
    "amis-ui": "^6.0.0",
    "amis-editor": "^6.0.0",
    "amis-editor-core": "^6.0.0",
    "axios": "^0.21.1",
    "mobx": "4.15.7",
    "mobx-react": "6.3.1",
    "mobx-state-tree": "3.17.3",
    "copy-to-clipboard": "^3.2.0",
    "qs": "^6.5.1",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-hook-form": "^7.39.0"
  },
}
  1. 操作步骤
    点击helloword第一条的编辑
    在编辑器应该出现的页面/index.html#/edit/0 报错
scheduler.development.js:178 Uncaught Error: The renderer with name "ae-classname" has already exists, please try another name!
    at registerRenderer (factory.js:86:15)
    at registerFormItem (Item.js:1051:73)
    at eval (Item.js:1055:24)
    at Object.__decorate (tslib.js:102:99)
    at eval (index.js:6:316165)
    at eval (index.js:6:316215)
    at ./node_modules/amis-editor/node_modules/amis-editor-core/lib/index.js (vendors-node_modules…_index_js.js:4153:1)
    at __webpack_require__ (index.js:24425:33)
    at fn (index.js:24717:21)
    at eval (index.js:14:22)

经过排查是amis-core(factory.js)

   config.weight = config.weight || 0;
    config.Renderer = config.component;
    config.name = config.name || config.type || "anonymous-".concat(anonymousIndex++);
    if (renderersMap[config.name]) {
        throw new Error("The renderer with name \"".concat(config.name, "\" has already exists, please try another name!"));
    }

的这一行代码有问题,renderersMap[config.name]的判断不合理捕获,在本地注释掉后可以正常运行