1
0
mirror of synced 2026-04-03 14:38:37 +08:00

docs: 文档描述修改

This commit is contained in:
roymondchen
2022-05-31 16:01:35 +08:00
committed by jia000
parent d2c936c5f0
commit 1db52c36b4
11 changed files with 37 additions and 21 deletions

View File

@@ -1,6 +1,9 @@
# 如何开发一个组件
tmagic-editor支持业务方进行自定义组件开发。在tmagic-editor中组件是以 npm 包形式存在的组件和插件只要按照规范开发就可以在tmagic-editor的 runtime 中被加入并正确渲染组件。
## 组件开发
以 vue3 的组件开发为例。运行项目中的 playground 示例,会自动加载 vue3 的 runtime。runtime会加载[@tmagic/ui](https://github.com/Tencent/tmagic-editor/tree/master/packages/ui)
## 组件注册
在 [playground](https://tencent.github.io/tmagic-editor/playground/index.html#/) 中,我们可以尝试点击添加一个组件,在模拟器区域里,就会出现这个组件。其中就涉及到组件注册。
@@ -8,9 +11,6 @@ tmagic-editor支持业务方进行自定义组件开发。在tmagic-editor中
可以参考 vue3 版本的 @tmagic/ui 中,[组件渲染](../guide/advanced/page.html#组件渲染)逻辑里type 会作为组件名进入渲染。所以在 vue3 的组件开发中,我们也需要在为 vue 组件声明 name 字段时,和 type 值对应起来,才能正确渲染组件。
## 组件开发
以 vue3 的组件开发为例。目前项目中的 playground 代码,会自动加载 vue3 相关的组件库。
### 组件规范
组件的基础形式,需要有四个文件
- index 入口文件,引入下面几个文件