2022-09-19 01:23:01 +00:00
|
|
|
|
# Application
|
|
|
|
|
|
2022-10-06 03:38:01 +00:00
|
|
|
|
## 构造函数
|
|
|
|
|
|
|
|
|
|
### `constructor()`
|
|
|
|
|
|
|
|
|
|
创建一个应用实例。
|
|
|
|
|
|
|
|
|
|
**签名**
|
|
|
|
|
|
|
|
|
|
* `constructor(options: ApplicationOptions)`
|
|
|
|
|
|
|
|
|
|
**示例**
|
|
|
|
|
|
2022-09-19 01:23:01 +00:00
|
|
|
|
```ts
|
|
|
|
|
const app = new Application({
|
|
|
|
|
apiClient: {
|
|
|
|
|
baseURL: process.env.API_BASE_URL,
|
|
|
|
|
},
|
|
|
|
|
dynamicImport: (name: string) => {
|
|
|
|
|
return import(`../plugins/${name}`);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 方法
|
|
|
|
|
|
2022-10-06 03:38:01 +00:00
|
|
|
|
### use()
|
2022-09-19 01:23:01 +00:00
|
|
|
|
|
2022-10-06 03:38:01 +00:00
|
|
|
|
添加 Providers,内置 Providers 有:
|
2022-09-19 01:23:01 +00:00
|
|
|
|
|
|
|
|
|
- APIClientProvider
|
|
|
|
|
- I18nextProvider
|
|
|
|
|
- AntdConfigProvider
|
|
|
|
|
- SystemSettingsProvider
|
|
|
|
|
- PluginManagerProvider
|
|
|
|
|
- SchemaComponentProvider
|
|
|
|
|
- SchemaInitializerProvider
|
|
|
|
|
- BlockSchemaComponentProvider
|
|
|
|
|
- AntdSchemaComponentProvider
|
|
|
|
|
- ACLProvider
|
|
|
|
|
- RemoteDocumentTitleProvider
|
2022-10-06 03:38:01 +00:00
|
|
|
|
|
|
|
|
|
### 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();
|
2023-07-07 06:35:22 +00:00
|
|
|
|
```
|