Framework interface
Mini Program
App(Param)
Register the Mini Program, accepting a parameter of type object
, specifying the Mini Program's lifecycle callbacks, etc.
App()
must be called in app.js
, must be called and can only be called once.
Param: object
name | description | required | type | default |
---|---|---|---|---|
onCreate | Triggered when the Mini Program initialization is completed, only triggered once globally. Can be used to initialize app global data for all pages, param parameter is passed from param parameter in hmApp.startApp | NO | (param: string) => void | - |
onDestroy | Triggered when the Mini Program is destroyed | NO | () => void | - |
other | The developer can add any function or data variable to the Param parameter | NO | any | - |
Usage reference Register Mini Program
Lifecycle related can be found in Life Cycle
getApp()
Gets the app instance.
Usage: Register Mini Program
Page
Page(Param)
Register a page in the Mini Program, accepting an object
type parameter, specifying the page's lifecycle callbacks, etc.
Param: object
name | description | required | type | default |
---|---|---|---|---|
onInit | Triggered when page initialization is complete, only once per page. Can be used to initialize page global data, the param parameter is passed by the param parameter in hmApp.gotoPage or hmApp.reloadPage | NO | (param: string) => void | - |
build | Triggered when page initialization is complete, only once per page. Recommended UI drawing in the build lifecycle | NO | () => void | - |
onDestroy | Triggered when the Mini Program is destroyed | NO | () => void | - |
Other | The developer can add any function or data variable to the Param parameter | NO | any | - |
Usage Reference Register Page
Lifecycle related can be found in lifecycle
Basic functions
console.log()
Console prints a log with any number of parameters.
px(value)
Tool method for doing screen adaptation.
type
(value: number) => number
Usage reference Screen Adaptation