使用的野狗云的微信登录来获取用户的openid是异步的 调用的是人家的没法改
app.js
wilddog.auth().signInWeapp().then(function (user) {
that.globalData.openid = user.uid
}).catch(function (err) {
console.log(err);
})
在index.js中有使用这个openid
that.setData({
openid: app.globalData.openid
})
在index.wxml中做判断用
<view class="{{item.openid===openid?'arrow-right':'arrow-left'}}"> </view>
我现在是在index.js中加了setTimeout来延迟执行但是完全还是比碰运气的
怎么能完全确保返回值已经有了 再执行呢
相关分类