# wx.setTopBarText(Object object)

Start from base library version 1.4.3. Please remaining backward compatible.

From base library 1.9.9 Start, this interface stops maintenance

with Promise style call: Supported

Need page permissions: Mini Programs cannot call this interface from a plugin page, and plugins cannot call the interface from the plugins page

Mini Program plugin: Not supported

Dynamically set the top column text content. If the current Mini Program is not capped, it will be called successfully, but it will not take effect immediately. Only after the user puts the Mini Program on the top will the text be changed.

# parameter

# Object object

attribute type Default values Required Introductions
text string yes Top bar text
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# sample code

wx.setTopBarText({
  text: 'hello, world!'
})

# Be careful

  • After successful invocation, interval 5s To call this interface again, if the 5s This interface is called again within the fail,errMsg:"setTopBarText: fail invoke too frequently"