Skip to content

Navigation Bar

setNavigationBarTitle

TIP

The API usage is as follows: wx.setNavigationBarTitle(Object object)

  • Functional description: Dynamically set the title of the current page.
  • Parameters and descriptions: Object object
PropertiesTypeDefault valueRequiredDescription
titlestring-YesPage title
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
js
wx.setNavigationBarTitle({
  title: 'current page'
})

setNavigationBarColor

TIP

The API usage is as follows: wx.setNavigationBarColor(Object object)

  • Functional description: Set the color of the page navigation bar.
  • Parameters and descriptions: Object object
PropertiesTypeDefault valueRequiredDescription
frontColorstring-YesForeground color value, including the color of buttons, titles, and status bar, only supports #ffffff and #000006
backgroundColorstring-YesBackground color value, valid value is hexadecimal color
animationobject-NoAnimation effect
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Structural properties of object.animation
PropertiesTypeDefault valueRequiredDescription
durationnumber0NoAnimation change time, unit ms
timingFuncstring'linear'NoAnimation change method
  • Legal value of object.animation.timingFunc

    ValueDescription
    'linear'The speed of the animation from beginning to end is the same
    'easeIn''Animation starts at a low speed
    'easeOut'Animation ends at a low speed
    'easeInOut'Animation starts and ends at a low speed
  • Sample code:

js
wx.setNavigationBarColor({
  frontColor: '#ffffff',
  backgroundColor: '#ff0000',
  animation: {
    duration: 400,
    timingFunc: 'easeIn'
  }
})

hideHomeButton

TIP

The API usage is as follows: wx.hideHomeButton(Object object)

  • Functional description: Hide the return to home button. When the bottom page of the mini program opened by the user is not the home page, the sharing panel displays the 'return to home' button by default, and the developer can call hideHomeButton in the page onShow to hide it.
  • Parameters and descriptions: Object object
PropertiesTypeDefault valueRequiredDescription
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)

showNavigationBarLoading

TIP

The API usage is as follows: wx.showNavigationBarLoading(Object object)

  • Functional description: Show the navigation bar loading animation on the current page.
  • Parameters and descriptions: Object object
PropertiesTypeDefault valueRequiredDescription
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)

hideNavigationBarLoading

TIP

The API usage is as follows: wx.hideNavigationBarLoading(Object object)

  • Functional description: Hide the navigation bar loading animation on the current page.
  • Parameters and descriptions: Object object
PropertiesTypeDefault valueRequiredDescription
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)