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