微信小程序动态修改页面标题

Page({
  data: {},
  onLoad: function (options) {
    var that = this;
    that.setData({
      mername: options.mername//options为页面路由过程中传递的参数
    })
    wx.setNavigationBarTitle({
      title: that.data.mername//页面标题为路由参数
    })
  },
  onReady: function () {
    // 页面渲染完成
  },
  onShow: function () {
    // 页面显示
  },
  onHide: function () {
    // 页面隐藏
  },
  onUnload: function () {
    // 页面关闭
  }
})

主要是这个API:wx.setNavigationBarTitle

小程序文档:https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html

转载地址:https://blog.csdn.net/m0_37893932/article/details/70155310

猜你喜欢

转载自blog.csdn.net/Bright2017/article/details/82912104
今日推荐