tachybase_todo/docs/en-US/api/client/application.md
2023-02-18 23:35:36 +08:00

1021 B

Application

Constructor

constructor()

Create an application instance.

Signature

  • constructor(options: ApplicationOptions)

Example

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.

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();