收藏
回答

信息发布成功后返回上一页面刷新列表?

为什么返回后数据没有刷新?

_send() {
    var that = this
    var temperature = this.data.currentTemperature
    var content = this.data.currentContent
    var contactWay = this.data.currentContactWay
    var type = this.data.typesOf


    wx.getLocation({
      type: 'gcj02',
      success(location) {
        const latitude = location.latitude
        const longitude = location.longitude


        wx.cloud.callFunction({
          // 云函数名称
          name: 'addPublishTask',
          // 传给云函数的参数
          data: {
            temperature: temperature,
            longitude: longitude,
            latitude: latitude,
            type: type,
            content: content,
            contentImages: uploadImageList,
            contactWay: contactWay
          },
        }).then(res => {
          console.log(res.result)
          if (res.result.errCode) { // // 发布失败
            that._sendFail(res.result)
            return
          }


          localImageList = []
          uploadImageList = []


          wx.hideLoading()
          // 刷新首页的列表
          that._postRefreshHomeList()
          wx.navigateBack()
          
        }).catch(error => {
          wx.hideLoading()


          that._sendFail(error)
        })


      }
    })
  },


console.log(prePage)已经成功获取到数据


_postRefreshHomeList(e) {
    var pages = getCurrentPages();
    var prePage = pages[pages.length - 2]
    // prePage.fetchMyCommunityActivityFollower()
    console.log(prePage)
  },
回答关注问题邀请回答
收藏

1 个回答

  • Admin ²º²⁴
    Admin ²º²⁴
    2020-06-30
    没调用prePage的刷新列表方法?
    
    2020-06-30
    有用
    回复 3
    • Qiu (吉²)
      Qiu (吉²)
      2020-06-30
      请问,怎么调用啊?
      2020-06-30
      回复
    • Admin ²º²⁴
      Admin ²º²⁴
      2020-06-30回复Qiu (吉²)
      你的prePage里面要有个刷新列表的方法XXX,然后prePage.XXX();
      2020-06-30
      回复
    • Qiu (吉²)
      Qiu (吉²)
      2020-06-30
      嗯嗯,非常感谢🙏
      2020-06-30
      回复
登录 后发表内容
问题标签