小程式 `navigateBack` 反向傳值給上一頁

Liuboxx1發表於2018-08-06
//點選地址反向傳值
  sendAddress: function(e) {
    let _this = this;
    var index = e.currentTarget.dataset.index;
    var address = _this.data.addressList[index];
    var pagesArr = getCurrentPages();
    if (pagesArr[pagesArr.length - 2].route == 'pages/submitOrder1/submitOrder1') {
      wx.navigateBack({
        delta: 1,   //回退前 delta 頁面
        success: function(res) {
          pagesArr[pagesArr.length - 2].setData({
            username: address.AddressName,
            telephone: address.Telephone,
            address: address.ProvinceName + address.CityName + address.CountyName + address.UserPlace + ' ' + address.DoorNumber,
          });
        },
        fail: function(res) {

        }
      });
    }
  }

相關文章