mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 22:57:38 +00:00
a6eebb940f
* feat: improve code * feat: update docs * feat: update docs * Update index.md * Update features.md * Update when.md * Update contributing.md * Update translations.md * feat: clean up * Add files via upload * Update the-first-app.md * Update plugins.md * Update a-b-c.md * Update blocks.md * feat: update docs * Add files via upload * Update charts.md * feat: update navs * Update index.md * Update index.md * Update features.md * Update index.md * Update docker-compose.md * Update create-nocobase-app.md * Update git-clone.md * Update contributing.md * Update translations.md * Update plugins.md * Update the-first-app.md * Add files via upload * Update charts.md * Update charts.md * Update a-b-c.md * Update collections.md * Update menus.md * Update menus.md Co-authored-by: Zhou <zhou.working@gmail.com>
62 lines
1005 B
Markdown
62 lines
1005 B
Markdown
# Application
|
||
|
||
## 构造函数
|
||
|
||
### `constructor()`
|
||
|
||
创建一个应用实例。
|
||
|
||
**签名**
|
||
|
||
* `constructor(options: ApplicationOptions)`
|
||
|
||
**示例**
|
||
|
||
```ts
|
||
const app = new Application({
|
||
apiClient: {
|
||
baseURL: process.env.API_BASE_URL,
|
||
},
|
||
dynamicImport: (name: string) => {
|
||
return import(`../plugins/${name}`);
|
||
},
|
||
});
|
||
```
|
||
|
||
## 方法
|
||
|
||
### use()
|
||
|
||
添加 Providers,内置 Providers 有:
|
||
|
||
- APIClientProvider
|
||
- I18nextProvider
|
||
- AntdConfigProvider
|
||
- RemoteRouteSwitchProvider
|
||
- SystemSettingsProvider
|
||
- PluginManagerProvider
|
||
- SchemaComponentProvider
|
||
- SchemaInitializerProvider
|
||
- BlockSchemaComponentProvider
|
||
- AntdSchemaComponentProvider
|
||
- ACLProvider
|
||
- RemoteDocumentTitleProvider
|
||
|
||
### render()
|
||
|
||
渲染 App 组件
|
||
|
||
```ts
|
||
import { Application } from '@nocobase/client';
|
||
|
||
export const app = new Application({
|
||
apiClient: {
|
||
baseURL: process.env.API_BASE_URL,
|
||
},
|
||
dynamicImport: (name: string) => {
|
||
return import(`../plugins/${name}`);
|
||
},
|
||
});
|
||
|
||
export default app.render();
|
||
``` |