From eee87c6d01a5d939aa9e9537e4e1125c2f87ef3a Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 27 Jan 2026 14:05:17 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E5=88=9B=E5=BB=BA=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E8=B7=AF=E5=BE=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/component.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/guide/component.md b/docs/guide/component.md index ac4635cd..e2112c95 100644 --- a/docs/guide/component.md +++ b/docs/guide/component.md @@ -17,10 +17,31 @@ tmagic-editor支持业务方进行自定义组件开发。在tmagic-editor中, :::tip -组件库并不是必须,组件如何管理可以根据具体情况来选择。直接放到 runtime 目录中也是一个不错的选择,如果选择放到runtime中可以在runtime中的package.json添加`"tmagicComponentsPath": "./components"` 来指定组件库的路径。这样在使用`npm create tmagic` 来创建组件时,会自动将组件添加到组件库中。 - +组件库并不是必须,组件如何管理可以根据具体情况来选择。直接放到 runtime 目录中也是一个不错的选择,如果选择放到runtime中可以在runtime中的package.json添加 +```json +{ + "createTmagic": { + "componentsPath": "./components", + "pluginsPath": "./plugins", + "dataSourcesPath": "./dataSources" + } +} +``` +来指定组件库的路径。这样在使用`npm create tmagic` 来创建组件时,会自动将组件添加到组件库中。 ::: +:::tip +如需为组件添加npm scope name,可以在runtime中的package.json中添加 +```json +{ + "createTmagic": { + "npmScopeName": "@tmagic" + } +} +``` +::: + + 手动创建组件,可以在项目中,如 runtime 目录中,创建一个名为 test-component 的组件目录,其中包含上面四个规范文件。 ```javascript // index.js