3 Star 8 Fork 2

阿库 / amis-vue-integration

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

amis-vue-integration

Vue2项目集成amis渲染器与编辑器,以及使用vue扩展amis组件

因为官方的amis-widget组件在vue2项目打包会重复打包amis,替换成@colys/amis-widget

原因是:

​ amis-widget组件import("amis-edit-core")

​ amis-edit-core 组件require("amis-theme-editor")

​ amis-theme-editor组件因为没有esm,所有是require('amis')

所有导致amis又有import又有require,所以修改了amis-widget的源码内amis-edit-core加载方式为require,打包发npm仓库(@colys/amis-widget)

image-20230219205302479

image-20230219205037949

主要代码:

注册vue组件到amis渲染器:src/widget/registerRenderer.js

amis编辑器自定义组件定义:src/editor/plugins/InfoCardPlugin.js

amis编辑器使用:src/editor/index.vue

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

如果报Remark组件重复的异常: The renderer with name "remark" has already exists, please try another name! 请注释 node_modules/amis-editor/esm/index.js 中所有amis-theme-editor的引用

//require('amis-theme-editor/lib/renderers/Border');
// require('amis-theme-editor/lib/renderers/ColorPicker');
// require('amis-theme-editor/lib/renderers/Font');
// require('amis-theme-editor/lib/renderers/PaddingAndMargin');
// require('amis-theme-editor/lib/renderers/Radius');
// require('amis-theme-editor/lib/renderers/Shadow');
// require('amis-theme-editor/lib/renderers/Size');
// require('amis-theme-editor/lib/renderers.css');

重新npm run dev

MIT License Copyright (c) 2023 阿库 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Vue2项目集成amis渲染器与编辑器,以及使用vue扩展amis组件 展开 收起
JavaScript 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/colys/amis-vue-integration.git
git@gitee.com:colys/amis-vue-integration.git
colys
amis-vue-integration
amis-vue-integration
master

搜索帮助