# Setup Functions
The setup functions are used to provide execution environment for the function-based APIs.
There are three setup functions for mini program: setupApp, setupPage, setupComponent.
# setupApp()
Arguments:
{object} configThe configuration for whole app.{Function} fnProvide an environment for function-based APIs.{object?} setupOptions{PluginClass[]?} pluginsAn array of plugins should be registered.
Returns: The configurations that used to pass into App.
Description:
setupApp()is used to generate App configurations.import { setupApp } from '@goldfishjs/composition-api'; import { IConfig } from '@goldfishjs/plugins'; const config: IConfig = { }; App(setupApp( config, () => { return { globalName: '1111', }; }), );1
2
3
4
5
6
7
8
9
10
11
12
13
14
# setupPage()
- Arguments:
{Function} fnProvide an environment for function-based APIs.
- Returns: The configurations that used to pass into Page.
# setupComponent()
- Arguments:
{object} defaultProps{Function} fnProvide an environment for function-based APIs.
- Returns: The configurations that used to pass into Component.