onShow: function () {
let pages = getCurrentPages(),
currPage = pages[pages.length - 1];
console.log(currPage.data)
if(currPage.data.uid !== undefined){
console.log('uid')
this.setData({
clickNumber: 0
});
console.log(this.data.clickNumber)
} else if (currPage.data.type === "2"){
var shsh = new Array();
shsh['name'] = currPage.data.name
shsh['mobile'] = currPage.data.mobile
shsh['address'] = currPage.data.address
shsh['city'] = currPage.data.city
shsh['county'] = currPage.data.county
shsh['province'] = currPage.data.province
console.log('收货')
console.log(currPage.data.mobile)
this.setData({
clickNumber: 0,
shsh: shsh
})
console.log(shsh);
}else{
console.log('其他')
this.setData({
clickNumber: 0,
})
}
},
onShow: function () {
var _this=this;
_this.setData({})//试试
}
你 吧shsh变成一个对象试一下 不要用数组
怎么个不生效法?没发现你说的问题
页面是不是有多个onShow啊
看看数据是否是正常的?
onShow: function () {
let pages = getCurrentPages(),
currPage = pages[pages.length - 1];
console.log(currPage.data)
if(currPage.data.uid !== undefined){
console.log('uid')
this.setData({
clickNumber: 0
});
console.log(this.data.clickNumber)
} else if (currPage.data.type === "2"){
var shsh = new Array();
shsh['name'] = currPage.data.name
shsh['mobile'] = currPage.data.mobile
shsh['address'] = currPage.data.address
shsh['city'] = currPage.data.city
shsh['county'] = currPage.data.county
shsh['province'] = currPage.data.province
console.log('收货')
console.log(currPage.data.mobile)
this.setData({
clickNumber: 0,
shsh: shsh
})
console.log(currPage.data)
console.log(shsh);
}else{
console.log('其他')
this.setData({
clickNumber: 0,
})
}
},
console.log(CurrentPage.data) 能打印出来吗
看看有没有报错,抛出异常之类的