当前位置:网站首页>vue-router路由缓存
vue-router路由缓存
2022-07-29 06:34:00 【二七二十七】
- 作用:让不展示的路由组件保持挂载,不被销毁
- 使用
<keep-alive></keep-alive>标签实现路由缓存,使用该标签包裹<router-view></router-view>标签,可以使通过路由在<router-view></router-view>位置处展示的组件全部进行缓存 - 在实际开发中只需要将部分组件进行缓存,通过
<keep-alive></keep-alive>标签中的include属性实现,指定include属性的属性值为需要进行缓存的组件名即可; - 若需要指定多个进行缓存的组件,将include属性的属性值为数组,在数组中放入组件名即可
// 缓存在<router-view></router-view>位置处展示的所有组件 <keep-alive> <router-view></router-view> </keep-alive> // 缓存在<router-view></router-view>位置处展示的单个指定组件 <keep-alive include="组件名"> <router-view></router-view> </keep-alive> // 缓存在<router-view></router-view>位置处展示的多个指定组件 <keep-alive include="['组件名1', '组件名2']"> <router-view></router-view> </keep-alive>
边栏推荐
- CVPR2021| 基于自监督学习的多视图立体匹配 (CVPR2021)
- MySQL 高级(进阶) SQL 语句 (一)
- buck电路boot和ph引脚实测
- Cvpr2022oral special series (I): low light enhancement
- 谷歌零碎笔记之JWT(草稿)
- MySQL advanced (Advanced) SQL statement (I)
- Summary of 2022 SQL classic interview questions (with analysis)
- Flink实时仓库-DWD层(处理复杂数据-流和表的装换处理)模板代码
- 2022年SQL经典面试题总结(带解析)
- Win11vmware turns on the virtual machine and restarts on the blue screen and the solution that cannot be started
猜你喜欢

接口测试实战项目03:执行测试用例

Thread synchronization - producers and consumers, tortoise and rabbit race, dual thread printing

win11系统错误:由于找不到 iertutil.dll,无法继续执行代码。重新安装程序可能会解决此问题

WPF嵌套布局案例

我的个人网站不让接入微信登录,于是我做了这个

Flink real time warehouse DWD layer (traffic domain) template code

记 - 踩坑-实时数仓开发 - doris/pg/flink

Operator3-设计一个operator

Use vscode to configure Mysql to realize connection, query, and other functions

buck电路boot电容短路和断路实测波形
随机推荐
IO stream - file - properties
Pod基本介绍
Basic knowledge of MySQL (high frequency interview questions)
Idea cannot find a database solution
使用VsCode配置MySQL实现连接、查询、等功能
Hj37 statistics of the total number of rabbits per month Fibonacci series
解决CSDN因版权不明而无法发布博客的问题
WPF 界面布局必知基础
Use vscode to configure Mysql to realize connection, query, and other functions
Student status management system based on C language design
2D cartoon rendering - advanced skills
Summary of 2022 SQL classic interview questions (with analysis)
VMware16创建虚拟机:Win11无法安装
[CF1054H] Epic Convolution——数论,卷积,任意模数NTT
After 4 years of development and 13K, if you want to change to automated testing, can your salary still rise···
Vite3.0 has been released, can you still roll it (list of new features)
1172. 餐盘栈 有序列表+栈
gin 参数验证
[redis] redis development specifications and precautions
gin 模版