2022-10-31 11:52:17 +08:00
|
|
|
# Application
|
|
|
|
|
2023-02-18 23:35:36 +08:00
|
|
|
## Constructor
|
2022-10-31 11:52:17 +08:00
|
|
|
|
|
|
|
### `constructor()`
|
|
|
|
|
2023-02-18 23:35:36 +08:00
|
|
|
Create an application instance.
|
2022-10-31 11:52:17 +08:00
|
|
|
|
2023-02-18 23:35:36 +08:00
|
|
|
**Signature**
|
2022-10-31 11:52:17 +08:00
|
|
|
|
|
|
|
* `constructor(options: ApplicationOptions)`
|
|
|
|
|
2023-02-18 23:35:36 +08:00
|
|
|
**Example**
|
2022-10-31 11:52:17 +08:00
|
|
|
|
|
|
|
```ts
|
|
|
|
const app = new Application({
|
|
|
|
apiClient: {
|
|
|
|
baseURL: process.env.API_BASE_URL,
|
|
|
|
},
|
|
|
|
dynamicImport: (name: string) => {
|
|
|
|
return import(`../plugins/${name}`);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2023-02-18 23:35:36 +08:00
|
|
|
## Methods
|
2022-10-31 11:52:17 +08:00
|
|
|
|
|
|
|
### use()
|
|
|
|
|
2023-02-18 23:35:36 +08:00
|
|
|
Add Providers, build-in Providers are:
|
2022-10-31 11:52:17 +08:00
|
|
|
|
|
|
|
- APIClientProvider
|
|
|
|
- I18nextProvider
|
|
|
|
- AntdConfigProvider
|
|
|
|
- SystemSettingsProvider
|
|
|
|
- PluginManagerProvider
|
|
|
|
- SchemaComponentProvider
|
|
|
|
- BlockSchemaComponentProvider
|
|
|
|
- AntdSchemaComponentProvider
|
|
|
|
- ACLProvider
|
|
|
|
- RemoteDocumentTitleProvider
|
|
|
|
|
|
|
|
### render()
|
|
|
|
|
2023-02-18 23:35:36 +08:00
|
|
|
Component to render the App.
|
2022-10-31 11:52:17 +08:00
|
|
|
|
|
|
|
```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-02-18 23:35:36 +08:00
|
|
|
```
|