796e73ae5a
* refactor(doc): change to new structure * docs: add database docs * docs: add collection docs * docs: add db field examples * docs(api): fix filename and menu path * docs: add database docs * docs: add db operators doc * docs: add resourcer menu * docs: add resourcer docs * docs: fix api docs * docs: refactor api menu structure * feat: update docs (#830) * feat: updates * feat: update docs * chore: ignore docs from ci Co-authored-by: Junyi <mytharcher@users.noreply.github.com> Co-authored-by: mytharcher <mytharcher@gmail.com> * docs: add database methods docs * docs: add missed api * docs: fix api docs * feat: update development docs (#833) * feat: update development docs * feat: update docs * feat: update docs * docs: add first plugin example (#834) * feat: update docs * feat: update docs * docs: fix typo Co-authored-by: chenos <chenlinxh@gmail.com>
34 lines
602 B
Markdown
34 lines
602 B
Markdown
# PluginManager
|
|
|
|
应用插件管理器的实例,由应用自动创建,可以通过 `app.pm` 访问。
|
|
|
|
## 实例方法
|
|
|
|
### `add()`
|
|
|
|
**签名**
|
|
|
|
* `add(pluginClass: PluginConstructor, options?: any): Plugin`
|
|
|
|
**参数**
|
|
|
|
| 参数名 | 类型 | 默认值 | 描述 |
|
|
| --- | --- | --- | --- |
|
|
| `pluginClass` | `PluginConstructor` | - | 插件类,参考 [Plugin 类](./plugin) |
|
|
|
|
**返回值**
|
|
|
|
对应插件类的实例
|
|
|
|
**示例**
|
|
|
|
```ts
|
|
import Application, { Plugin } from '@nocobase/server';
|
|
|
|
class MyPlugin extends Plugin {}
|
|
|
|
const app = new Application();
|
|
|
|
app.pm.add(MyPlugin, { a: 1 });
|
|
```
|