Skip to main content
Version: v3

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

namedescriptionrequiredtypedefault
onCreateTriggered 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.startAppNO(param: string) => void-
onDestroyTriggered when the Mini Program is destroyedNO() => void-
otherThe developer can add any function or data variable to the Param parameterNOany-

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

namedescriptionrequiredtypedefault
onInitTriggered 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.reloadPageNO(param: string) => void-
buildTriggered when page initialization is complete, only once per page. Recommended UI drawing in the build lifecycleNO() => void-
onDestroyTriggered when the Mini Program is destroyedNO() => void-
OtherThe developer can add any function or data variable to the Param parameterNOany-

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