mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 19:26:47 +00:00
63 lines
1021 B
Markdown
63 lines
1021 B
Markdown
# Application
|
|
|
|
## Constructor
|
|
|
|
### `constructor()`
|
|
|
|
Create an application instance.
|
|
|
|
**Signature**
|
|
|
|
* `constructor(options: ApplicationOptions)`
|
|
|
|
**Example**
|
|
|
|
```ts
|
|
const app = new Application({
|
|
apiClient: {
|
|
baseURL: process.env.API_BASE_URL,
|
|
},
|
|
dynamicImport: (name: string) => {
|
|
return import(`../plugins/${name}`);
|
|
},
|
|
});
|
|
```
|
|
|
|
## Methods
|
|
|
|
### use()
|
|
|
|
Add Providers, build-in Providers are:
|
|
|
|
- APIClientProvider
|
|
- I18nextProvider
|
|
- AntdConfigProvider
|
|
- RemoteRouteSwitchProvider
|
|
- SystemSettingsProvider
|
|
- PluginManagerProvider
|
|
- SchemaComponentProvider
|
|
- SchemaInitializerProvider
|
|
- BlockSchemaComponentProvider
|
|
- AntdSchemaComponentProvider
|
|
- ACLProvider
|
|
- RemoteDocumentTitleProvider
|
|
|
|
### render()
|
|
|
|
Component to render the 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();
|
|
```
|