Detailed explanation of the solution to the problem that the WeChat applet encounters a problem where the page does not render after modifying data

高洛峰
Release: 2018-05-11 11:56:18
Original
7209 people have browsed it

This article mainly introduces relevant information on how to solve the problem of the page not rendering after the WeChat applet encounters modified data. Friends in need can refer to the following

After the WeChat applet encounters modified data Solving the problem of page not rendering

Foreword:

From the beginning of the mini program last year to now, I have always been optimistic about it and maintained a certain degree of attention. , I think the wave of small programs was initially among the front-end and other technology developers. This is the first time I have consciously witnessed the development of a new technology, and I feel quite honored.
Badmouthing mini programs? My point of view is that it is definitely impossible, because now the small program of review is submitted every day. It continues to increase, and some mini programs are really easy to use, such as Mobike’s QR code scanning for cycling, and I went to KTV last week and directly used the mini program to scan the QR code on the screen to bind the room, and then through Mini programs are convenient and fun for requesting songs, cutting songs, and sending emojis. Therefore, in my opinion, some application scenarios are very suitable for mini programs. In the future, more scenes in life will use mini programs.

Up to now, I have written more than a dozen articles in the mini program series, which basically solve some problems and pitfalls in development. My mini program has almost been written, but the company’s. The https encryption authentication has not been completed yet, so I can only leave it there for the time being

Data modification does not take effect

I will continue to introduce a set## today. #Data() problem.

We often write like this:

var that = this;
wx.getStorage({
  key: 'user',
  success: function(res){
    console.log(res.data)
    that.data.params.uuid = res.data.uuid;
    that.data.params.ticket = res.data.ticket;
    that.data.params.courseUuid = options.courseUuid;
    that.data.params.isCompany = options.isCompany;

    that.fetchData();
    that.getShareList();
  }
})
Copy after login

We performed some assignment operations on the data

object, but found that we then use these The data was wrong. The data we assigned was not successfully rendered to the page. After searching for a long time, I found that in order for the data to take effect immediately, the setData() method must be called to be useful, so the above code is modified as follows. :

var that = this;
wx.getStorage({
  key: 'user',
  success: function(res){
    console.log(res.data)
    that.data.params.uuid = res.data.uuid;
    that.data.params.ticket = res.data.ticket;
    that.data.params.courseUuid = options.courseUuid;
    that.data.params.isCompany = options.isCompany;

    that.setData({
      params: that.data.params
    })

    that.fetchData();
    that.getShareList();
  }
})
Copy after login

Thank you for reading, I hope it can help you, thank you for your support of this site!

The above is the detailed content of Detailed explanation of the solution to the problem that the WeChat applet encounters a problem where the page does not render after modifying data. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!