Home  >  Article  >  Web Front-end  >  How to solve the problem that the page will not render after uniapp is packaged

How to solve the problem that the page will not render after uniapp is packaged

藏色散人
藏色散人Original
2020-12-22 17:32:254151browse

Uniapp will not render the page after being packaged because vue two-way binding is invalid. The solution is: first open the corresponding code file; then use "this.$forceUpdate" to force refresh the data.

How to solve the problem that the page will not render after uniapp is packaged

The operating environment of this tutorial: windows7 system, uni-app2.5.1 version. This method is suitable for all brands of computers.

Recommended (free): uni-app development tutorial

Specific questions:

onShow event data after uniapp packages the APP The data is refreshed but the page is not rendered.

When the "My" page is not logged in, the nickname displays "Please log in", then click "Please log in" to jump to the login page. After successful login, the user is cached through uni.setStorage data The nickname is saved to the cache, and then returned to the "My" page. It is found that the nickname data data has changed to the user nickname in the cache, but the content of the text tag bound to the nickname data on the page has not changed. It is still "Please log in".. .

This is my text binding data code

How to solve the problem that the page will not render after uniapp is packaged

After successful login, retrieve the nickname from the cache and assign a value to the data

How to solve the problem that the page will not render after uniapp is packaged

Before logging in, because the nickname is "", it will display Please log in

How to solve the problem that the page will not render after uniapp is packaged

After successful login, the value of nickname will be retrieved from the cache, so the nickname will be The location will change

How to solve the problem that the page will not render after uniapp is packaged

The browser side works normally, but after packaging it into an APP, the "Please log in" remains unchanged, but the value of the nickname does change. I tried to retrieve it from the document. The id assignment doesn't work, and the jQuery id assignment doesn't work either. I don't know if it's a problem with Android. My Android version is 10

Solution:

The reason is because vue is bound in two directions Definitely invalid, use this.$forceUpdate to force refresh the data!

The above is the detailed content of How to solve the problem that the page will not render after uniapp is packaged. 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