2022-09-19 09:23:01 +08:00
|
|
|
# PluginManager
|
|
|
|
|
|
|
|
应用插件管理器的实例,由应用自动创建,可以通过 `app.pm` 访问。
|
|
|
|
|
|
|
|
## 实例方法
|
|
|
|
|
2022-09-23 09:22:17 +08:00
|
|
|
### `create()`
|
2022-09-19 09:23:01 +08:00
|
|
|
|
2022-10-27 13:00:16 +08:00
|
|
|
在本地创建一个插件脚手架
|
|
|
|
|
|
|
|
**签名**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
create(name, options): void;
|
|
|
|
```
|
|
|
|
|
|
|
|
### `addStatic()`
|
|
|
|
|
|
|
|
**签名**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
addStatic(plugin: any, options?: PluginOptions): Plugin;
|
|
|
|
```
|
|
|
|
|
|
|
|
**示例**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
pm.addStatic('nocobase');
|
|
|
|
```
|
|
|
|
|
2022-09-23 09:22:17 +08:00
|
|
|
### `add()`
|
2022-09-19 09:23:01 +08:00
|
|
|
|
2022-10-27 13:00:16 +08:00
|
|
|
**签名**
|
2022-09-19 09:23:01 +08:00
|
|
|
|
2022-10-27 13:00:16 +08:00
|
|
|
```ts
|
|
|
|
async add(plugin: any, options?: PluginOptions): Promise<Plugin>;
|
|
|
|
async add(plugin: string[], options?: PluginOptions): Promise<Plugin[]>;
|
|
|
|
```
|
2022-09-19 09:23:01 +08:00
|
|
|
|
2022-10-27 13:00:16 +08:00
|
|
|
**示例**
|
|
|
|
|
|
|
|
```ts
|
|
|
|
await pm.add(['test'], {
|
|
|
|
builtIn: true,
|
|
|
|
enabled: true,
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
### `get()`
|
|
|
|
|
|
|
|
获取插件实例
|
2022-09-19 09:23:01 +08:00
|
|
|
|
2022-09-23 09:22:17 +08:00
|
|
|
### `enable()`
|
2022-09-19 09:23:01 +08:00
|
|
|
|
2022-09-23 09:22:17 +08:00
|
|
|
### `disable()`
|
2022-09-19 09:23:01 +08:00
|
|
|
|
2022-09-23 09:22:17 +08:00
|
|
|
### `remove()`
|
2022-10-27 13:00:16 +08:00
|
|
|
|
|
|
|
### `upgrade()`
|