This article describes how to solve the problem of no page rendering after data modification by a applet, for more information about how to solve the problem that the page does not render after the data is modified
Solve the problem that the page is not rendered after the data is modified by the applet
Preface:
I have been optimistic about and maintain a certain degree of attention since the beginning of my application last year, I think it was my first time to consciously witness the development of a new technology in front-end and other technical development groups.
Sing Down the applet? My point of view is definitely not possible, because the daily submission of http://www.php.cn/php/php-shenhe.html "target =" _ blank "> The Review of small programs continues to increase, and some small programs are really useful, for example, Mobai's QR code scanning bike, and I went to KTV last week, and directly scanned the QR code on the screen with a small program, so that I could bind the room and then use the applet to sing and cut songs, it is easy to make table packages and other interesting things. Therefore, in my opinion, some application scenarios are very suitable for small programs. in the future, more scenarios will have more applications and small programs.
Up to now, I have written more than a dozen articles in the mini-program series, basically solving some problems in development and hitting the pitfalls. My applet has already been written almost, but the company's https encryption authentication has not been completed, so it can only be put on hold for now.
Invalid data modification
We will continue to discuss a setData () issue today.
We often write 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.fetchData(); that.getShareList(); }})
We assigned values to the data object, but we found that the data was not correct when we continued to use the data. the assigned data was not successfully rendered to the page. After looking for a long time, I found that to immediately validate data, you must call the setData () method to make it useful. Therefore, 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 this article. I hope it will help you. thank you for your support for this site!
The above is a detailed explanation of the solution to the problem that the page does not render after the data is modified by the applet. For more information, see other related articles in the first PHP community!