


How to deal with v-cloak flickering when refreshing and loading in vue
This time I will show you how to deal with v-cloak flickering when refreshing and loading in vue. How to deal with v-cloak flickering during refreshing and loading in vue. What are the precautions. Here is the actual combat. Let’s take a look at the case.
When using vue to bind data, variables will flash when rendering the page. For example,
<p class="#app"> <p>{{value.name}}</p> </p>
will see
when loading. {{value.name}}
appears on the page, and the data will be rendered after a few seconds. There is an instruction in vue to solve this problem, v-cloak
So, where should v-cloak be placed? Should this instruction be added to every label that needs to render data? After experiments, it was found that v-cloak does not need to be added to every label, as long as it is hung in el Just add
<p class="#app" v-cloak> <p>{{value.name}}</p> </p>
to the loaded tag, and add
[v-cloak] { display: none; }
to the css to prevent the page from flickering.
But sometimes it doesn’t work. There are two possible reasons:
1. The display attribute of v-cloak is overwritten by a higher level one. , so we need to increase the level
[v-cloak] { display: none !important; }
2. The style is placed in the css file introduced by @import
The style of v-cloak does not work if it is placed in the css file introduced by @import. It can be placed in the css file introduced by link or in the inline style
Supplement:
Let’s take a look at v in Vue -cloak interpretation
The role and usage of v-cloak
Usage:
This directive remains on the element until the associated instance ends compilation . When used with CSS rules such as [v-cloak] { display: none }, this directive can hide uncompiled Mustache tags until the instance is ready. Official API
<p id="app"> {{msg}} </p>
HTML is bound to the Vue instance. When the page is loaded, it will flash
and then the word "loading completed" will appear. In order to make the effect more obvious, we can delay loading the Vue instance
setTimeout(() => { new Vue({ el: '#app', data: { msg: 'hello' } }) },2000)
v-cloak can solve this problem. Add
[v-cloak] { display: none; }
to the css and add v-cloak to the loading point in the html.
<p id="app" v-cloak> {{msg}} </p>
The difference between v-cloak in Vue1. You need to use another p to accommodate the entire page content and instantiate it
In this way, when using v-cloak, you also need to use this methodWhy do I use it v-cloak not working?
In actual projects, we often load css files through @import
@import "style.css" @import "index.css"
Detailed explanation of the use of JS decorator functions
##vue.js element-ui implements tree structure
The above is the detailed content of How to deal with v-cloak flickering when refreshing and loading in vue. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

After upgrading to the official version of Win10 and entering the Windows desktop, I found that the screen kept flickering and I could not perform tasks at this time. The editor recently encountered this problem after upgrading to the official version of Win10. After repeated thinking and exploration in the background, the problem was finally solved. Now I will share with you the specific solution. After upgrading to the official version of Win10, most users using the Win10 system have encountered the problem of screen flickering. This is usually due to running incompatible software or a graphics card driver failure. So what causes the Win10 screen to flicker? what can we do about it? The following are solutions to Win10 computer screen flickering. What should I do if my Win10 computer screen keeps flickering? Right-click "This" on the desktop.

Vue error: Unable to use v-cloak instruction correctly to solve the display problem? In recent years, with the rapid development of front-end technology, Vue.js, as a popular JavaScript framework, has been favored by more and more developers. In the process of building front-end applications with Vue.js, we may encounter various problems and errors. One of the common problems is that the v-cloak command cannot be displayed correctly. This article will detail this problem and provide a solution. Problem Description When we

CSS Animation Tutorial: Teach you step by step how to implement flashing text effects CSS (CascadingStyleSheets) is a markup language used to add style and layout to web pages. By using CSS, we can add animation effects to HTML elements to make web pages more vivid and attractive. In this tutorial, I'll show you how to use CSS to implement a simple blinking text effect. You'll learn how to use CSS animation properties and how to apply animation to text to achieve a blinking effect. by

Does your iPhone camera flicker or flicker too much in indoor lights? Videos you shoot with your iPhone won't look good because the lights will be on. The flicker you see on your video is because of the difference in refresh rates. This is not normal and there are ways to fix this. This fix will help you solve the continuous flickering or flickering effect in iPhone videos. Fix – Change Video Output Format The reason behind this phenomenon is the apparent difference between the refresh rate of the object and the camera lens. Usually, if you use iPhone to record your screen, the video will flicker or flicker a lot. However, if you record a normal video, it shouldn't flicker. This phenomenon is mainly due to the mismatch between the refresh rate of the screen and the frame rate of the camera. The screen refresh rate is usually

What are the employment prospects of clinical pharmacy at Harbin Medical University? Although the national employment situation is not optimistic, pharmaceutical graduates still have good employment prospects. Overall, the supply of pharmaceutical graduates is less than the demand. Pharmaceutical companies and pharmaceutical factories are the main channels for absorbing such graduates. The demand for talents in the pharmaceutical industry is also growing steadily. According to reports, in recent years, the supply-demand ratio for graduate students in majors such as pharmaceutical preparations and natural medicinal chemistry has even reached 1:10. Employment direction of clinical pharmacy major: After graduation, students majoring in clinical medicine can engage in medical treatment, prevention, medical research, etc. in medical and health units, medical research and other departments. Employment positions: Medical representative, pharmaceutical sales representative, sales representative, sales manager, regional sales manager, investment manager, product manager, product specialist, nurse

How to clean the temp folder As we use the computer, temporary files (temp files) will gradually accumulate. These temporary files are generated when we use the computer, such as cache files when browsing the web, temporary files during software installation, etc. Failure to clean the temp folder for a long time may occupy a large amount of disk space and affect the speed of the computer. Therefore, cleaning the temp folder regularly is a necessary step to maintain computer performance. Below, we will introduce some simple ways to clean the temp folder. Method 1: Manually clean t

Recently, some friends reported how to download win10 image files. Because there are so many image files on the market, what should I do if I want to find a regular file to download? Today, the editor has brought you the link to download the image and the detailed solution steps. Let’s take a look at them together. win10 image quick download and installation tutorial download link >>> System Home Ghostwin101909 image 64-bit version v2019.11<<<>>>Win10 image 64-bit v2019.07<<<>>>Win10 image 32-bit v2019.07<< <1. Search through the Internet

1. Click the Win icon in the lower left corner of the computer desktop, and click the [Control Panel] option in the pop-up menu list. 2. Change the [View By] of the [Control Panel] folder to the [Large Icons] option. 3. Double-click the [Display] option below. 4. Click the [Change Monitor Settings] option in the [Display] folder. 5. Click the [Advanced Settings] option in the [Change Monitor Settings] window. 6. Click the [Monitor] option in the [Properties] window. 7. In the [Monitor] tab, adjust the frequency in [Screen Refresh Frequency] to the highest value and click the [OK] button.
