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
When we design a page, we often need to center th...
Table of contents Introduction to the Decorator P...
When making some pages, in order to make the page...
Deepin 2014 download and installation For downloa...
Nginx supports three ways to configure virtual ho...
The following introduces the commonly used head s...
This article records the specific method of insta...
Previously, react.forwardRef could not be applied...
In MySQL, you can use IF(), IFNULL(), NULLIF(), a...
Table of contents 1. rsync, cp copy files 2. sele...
When we install and configure the server LNPM env...
MySQL password modification example detailed expl...
Table of contents 1. Component Introduction 2. So...
Docker provides a way to automatically deploy sof...
Table of contents View all storage engines InnoDB...