拿不到:
改变代码:var _this = this;
onLoad() {
var _this = this;
// 拿到导航类别缓存
uni.getStorage({
key: 'key1',
success: function(res) {
console.log("导航类别", res.data);
_this.mainindex = res.data;
}
});
console.log(_this.mainindex)
},
可以拿到了