tachybase_todo/docs/en-US/api/client/application.md

62 lines
993 B
Markdown
Raw Normal View History

# Application
2023-02-18 23:35:36 +08:00
## Constructor
### `constructor()`
2023-02-18 23:35:36 +08:00
Create an application instance.
2023-02-18 23:35:36 +08:00
**Signature**
* `constructor(options: ApplicationOptions)`
2023-02-18 23:35:36 +08:00
**Example**
```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
### use()
2023-02-18 23:35:36 +08:00
Add Providers, build-in Providers are:
- APIClientProvider
- I18nextProvider
- AntdConfigProvider
- SystemSettingsProvider
- PluginManagerProvider
- SchemaComponentProvider
- SchemaInitializerProvider
- BlockSchemaComponentProvider
- AntdSchemaComponentProvider
- ACLProvider
- RemoteDocumentTitleProvider
### render()
2023-02-18 23:35:36 +08:00
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();
2023-02-18 23:35:36 +08:00
```