var postsCollected = wx.getStorageSync('Posts_Collected');
if (postsCollected) {
var postCollected = wx.postsCollected[postId]
if(postCollected){
this.setData({
collected: postCollected
})
}
}
else{
var postsCollected={};
postsCoolected=false;
wx.setStorageSync("Posts_collected", postsCollected)
}
这段代码我对下,没有什么错呀!为什么老是报错这个呢?老师帮忙看下,就是if判断这边还是有问题,我打断点,下面的不执行,而且报错,这段代码不执行了
if(postCollected){
this.setData({
collected: postCollected
})
}
}
else{
var postsCollected={};
postsCoolected=false;
wx.setStorageSync("Posts_collected", postsCollected)
}
4年同步微信官方迭代,累计20000+人学习, 比微信官方更火爆!
了解课程