声明周期中,onShow执行了,this.data.logStep值也变了,但是页面中的值没有变化
<view class='Popup' hidden='{{iShidden}}'>
<!-- <image src='{{logo_url}}'></image> -->
<view wx:if="{{logStep == 0}}">
<view class='title'>授权提醒{{logStep}}</view>
<view class='tip'>请授权头像等信息,以便为您提供更好的服务</view>
<view class='bottom flex'>
<button class='item grant on' type="primary" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="setUserInfo">去授权</button>
</view>
</view>
<view wx:if="{{logStep == 1}}">
<view class='title'>手机号登录{{logStep}}</view>
<view class='tip'>请登录手机号,以便为您提供更好的服务</view>
<view class='bottom flex'>
<button class='item grant on' type="primary" bindtap="goPhone">去登录</button>
</view>
</view>
</view>
pageLifetimes: {
hide: function () {
//关闭页面时销毁定时器
if (this.data.cloneIner) clearInterval(this.data.cloneIner);
},
show: function () {
console.log("9-------------111");
console.log(app.globalData.logStep);
// this.initAutorDig();
//打开页面销毁定时器
console.log(selfCom)
selfCom.setStateStatus();
if (this.data.cloneIner) clearInterval(this.data.cloneIner);
},
},
attached() {
console.log("attached--")
selfCom = this;
this.initAutorDig();
},
setStateStatus: function(){
var logStep = app.globalData.logStep;
//授权后隐藏,没授权后显示弹窗
//logStep = 0,没授权,弹窗信息
//logStep = 1,授权手机号
//logStep = 2 授权通过
if(logStep == 0){
//自动弹出授权
this.setData({
iShidden: false,
logStep: 0
});
console.log("set------0")
console.log("set---------------------"+this.data.logStep)
}
if(logStep == 1){
this.setData({
iShidden: false,
logStep: 1
});
console.log("set------1")
console.log("set---------------------"+this.data.logStep)
}
if(logStep == 2){
//自动弹出授权
this.setData({
iShidden: true,
logStep: 2
});
console.log("set------2")
console.log("set---------------------"+this.data.logStep)
}
},