search
HomeWeChat AppletMini Program DevelopmentDetailed explanation of the solution to the problem that the WeChat applet encounters a problem where the page does not render after modifying data

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();
  }
})

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();
  }
})

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment