The child page of the WeChat applet dynamically modifies the text content of the navigation bar title

Insert image description here

In actual project development, generally the title text of our page navigation bar is not fixed, but is dynamically set according to the needs of the scene. How to implement this. The methods officially provided by WeChat are as follows:

1. Set up dynamic

onLoad: function (options) {
    
    
wx.setNavigationBarTitle({
    
     title: options.name })      // options.name表示上个页面传过来的文字
},

2. Direct setting

onLoad: function (options) {
    
    
wx.setNavigationBarTitle({
    
     title: '我要出租' })  
},

We can choose according to our own project needs.

Reference article: https://blog.csdn.net/weixin_40967353/article/details/115300337

Guess you like

Origin blog.csdn.net/ws19900201/article/details/124574262