mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-02-02 00:28:10 +00:00
docs: 创建组件的默认路径配置修改
This commit is contained in:
parent
0b7b6884ae
commit
eee87c6d01
@ -17,10 +17,31 @@ tmagic-editor支持业务方进行自定义组件开发。在tmagic-editor中,
|
|||||||
|
|
||||||
:::tip
|
:::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 的组件目录,其中包含上面四个规范文件。
|
手动创建组件,可以在项目中,如 runtime 目录中,创建一个名为 test-component 的组件目录,其中包含上面四个规范文件。
|
||||||
```javascript
|
```javascript
|
||||||
// index.js
|
// index.js
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user