Skip to main content
Version: v3

getCurrentPage

Start from API_LEVEL 2.0 . Please refer to API_LEVEL.

Get the page instance object.

Type

function getCurrentPage(): Result

Parameters

Result

PropertyTypeDescriptionAPI_LEVEL
_optionsOptionspage instance property2.0

Options

PropertyTypeRequiredDefaultValueDescriptionAPI_LEVEL
stateobjectN-mounted data objects on page instances2.0

Example

page.js
Page({
state: {
text: 'Hello Zepp OS',
},
onInit() {
console.log('onInit')
},
build() {
console.log('build')
console.log(this.state.text)
},
})

const page = getCurrentPage()
console.log(page._options.state.text)