wx.hideNavigationBarLoading()在非首个tab下失效
发布于 6 年前 作者 pengjun 15616 次浏览 来自 问答
var app = getApp();
Page({
  data: {
    //id: 121,
    logo: getApp().globalData.logo,
    title: getApp().globalData.title,
    post_title:"",
    hasContent: "",
    content:""
  },
  onLoad: function(options){
    var that = this;
    wx.showNavigationBarLoading();
    var id = options.id
    wx.request({
      url: getApp().globalData.url+'wp-json/wp/v2/pages/'+ id,
      data: {
         items: 'id,title,date,content'
      },
      header: {
        'content-type': 'application/json'
      },
      success: function(res) {
        that.setData({
          load:true,
          post_title: res.data.title.rendered,
          content: res.data.content.rendered
        })
      },
      complete: function() {
        wx.hideNavigationBarLoading();
      }
    })
  },
  onPullDownRefresh: function(options) {
    var that = this;
    this.onLoad();
    wx.stopPullDownRefresh();
  },
})

代码如上,如果是设成第一个入口,就能正常隐藏loadingBar,但通过tabBar进入后,该功能失效

1 回复

PS:开发者工具下正常,ios真机下才有这个问题

回到顶部