I got an error when I clicked on favorites.
叶子
叶子 2018-12-06 19:18:02
0
2
1394

Following the video, an error was reported: Cannot create property '0' on string '';



叶子
叶子

reply all(1)
尾生

//When entering for the first time, determine whether there is local storage and whether to collect it

var newsCollect = wx.getStorageSync('newsCollect');

Represents previous collection or cancellation of collection

If(newsCollect){

var newCollect = newsCollect[options.newsid];

this.setData({

              collected:newCollect

##                                                                                                                                                                    NewsCollect[options. newsid] = false; :function(event){

//NewCollect is the collection of all data

var newsCollect = wx.getStorageSync('newsCollect');

//newCollect is the current piece of data

var newCollect=newsCollect[this.data.newsid];

//When clicked, cancel if collected, collect if not collected

newCollect= !newCollect ;

//Update to local storage

newsCollect[this.data.newsid] = newCollect;

wx.setStorageSync('newsCollect' , newsCollect);

This.setData({

                                                                                                                                                                                    use })

console.log(newCollect);

}

This can come out

  • reply I'm in the same situation. If you write it like this, you'll still get an error.
    唐俊 author 2019-05-26 14:15:37
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template