收藏
回答

wx.hideNavigationBarLoading()在非首个tab下失效

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 个回答

  • 2017-04-25

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

    2017-04-25
    有用
    回复
登录 后发表内容