Method 1: Call the function directlyReload the entire page. Either of the following will work:
Method 2: Use provide / inject (static refresh)Declare a reload refresh function in the higher-order function <template> <div id="app" v-if="show"></div> </template> <script> export default { //Control display/hide, implement refresh data () { return { show: true } }, // Pass the refresh method to the low-level component provide () { return { reload: this.reload } }, methods: { // High-level component defines refresh method reload () { this.bol = false this.$nextTick(() => { this.bol = true }) } } } </script> Using refresh functions in low-level components <template> <div></div> </template> <script> export default { inject: ['reload'], methods: { // Low-level component, refresh fun () { this.reload() } } } </script> Advantages Comparison
The above is the details of the method of applying provide and inject to refresh the Vue page. For more information about Vue page refresh, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Detailed explanation of root directory settings in nginx.conf
>>: Which one should I choose between MySQL unique index and normal index?
This article uses examples to explain the princip...
Table of contents Application Scenario Simply put...
A transaction is a logical group of operations. E...
Create a new project test1 on Code Cloud Enter th...
Many web pages have small triangles in their navi...
Table of contents Add Configuration json configur...
Here are some points to note when registering Tom...
operating system: Win10 Home Edition Install Dock...
In CSS, text is one of the most common things we ...
This article example shares the specific code of ...
Preface Most of our MySQL online environments use...
React is an open-source JavaScript library used b...
Redis Introduction Redis is completely open sourc...
Table of contents 1. Common higher-order function...
The following script is used for scheduled backup...