3 ways to implement tab switching in Vue1. v-show controls content switching
2. Data rendering principle: mainly use the index bound by v-for to control, which is similar to the above. 2. Component switching.
3. Route switching. (Friendly for address bar and data request)
vue tab switch keeps data statusWhen switching tabs on a page, since the component will be re-instantiated every time it is switched, we want the content in the tab to remain unchanged no matter how the page is switched, reducing page re-rendering and requests. Implementation method: Use <keep-alive></keep-alive> to wrap the component <el-tabs v-model="activeName" @tab-click="handleClick"> <el-tab-pane label="Record"> <keep-alive> <child1 v-if="isChildUpdate"></child1> </keep-alive> </el-tab-pane> </el-tabs> Jump to details on the list page, and keep the last operation status on the list page This is achieved by loading router-view and setting the routing meta page to cache. If router-view is nested in multiple layers, you may need to set up multiple layers, and then use beforeRouteLeave to listen to the route leaving and set whether to cache // Jumping from other pages does not require caching of pages. Returning from the details page requires caching. SummarizeThis concludes this article about 3 ways to implement tab switching in Vue and how to maintain data status during switching. For more information about Vue tab switching methods, please search previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to Monitor Linux Memory Usage Using Bash Script
>>: Detailed explanation of new relational database features in MySQL 8.0
Table of contents 1. for loop: basic and simple 2...
Configuring Alibaba Cloud Docker Container Servic...
*** Example of setting the style of a hyperlink a...
I mainly introduce how to develop a lucky wheel g...
Table of contents Preface: Ubuntu 18.04 changes a...
(1) Introduction: clipboard.js is a lightweight J...
1. Always close HTML tags In the source code of p...
Preface When the code runs and an error occurs, w...
Long story short, today we will talk about using ...
Monday to Sunday time format conversion (Y --- ye...
Create table & create index create table tbl1...
Today, when I was configuring Tomcat to access th...
Achieve results First use HTML to build a basic f...
Table of contents 1. Introduction to the connecti...