当前位置:网站首页>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>
边栏推荐
- [cf1054h] epic Revolution -- number theory, convolution, arbitrary modulus NTT
- Redis基础篇
- win11系统错误:由于找不到 iertutil.dll,无法继续执行代码。重新安装程序可能会解决此问题
- Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
- Cesium反射
- Teacher Wu Enda's machine learning course notes 04 multiple linear regression
- Leetcode-592: fraction addition and subtraction
- Decompilation of wechat applet
- Is online legend software testing training really so black hearted? Are they all scams?
- Simulation volume leetcode [normal] 081. Search rotation sort array II
猜你喜欢

基于C语言实现图书借阅管理系统

Excel文件读写(创建与解析)

OCR光学字符识别方法汇总

Decompilation of wechat applet

Improved Pillar with Fine-grained Feature for 3D Object Detection论文笔记

Student status management system based on C language design

Vite3.0 has been released, can you still roll it (list of new features)

MySQL advanced (Advanced) SQL statement (I)

个人博客系统(附源码)

微服务远程调用
随机推荐
CVPR2021| 基于自监督学习的多视图立体匹配 (CVPR2021)
Record - step on the pit - real-time data warehouse development - doris/pg/flink
Simulation volume leetcode [normal] 061. rotating linked list
MySQL 有这一篇就够(呕心狂敲37k字,只为博君一点赞!!!)
Windows 上 php 7.4 连接 oracle 配置
[C language brush leetcode] 67. binary sum (E)
基于C语言实现图书借阅管理系统
npm install 时,卡住不动,五种解决方法
Simulation volume leetcode [normal] 081. Search rotation sort array II
谷歌零碎笔记之JWT(草稿)
[C language brush leetcode] 2332. The latest time to get on the bus (m)
【C语言刷LeetCode】67. 二进制求和(E)
MySQL - multi table query
npm install报错npm ERR Could not resolve dependency npm ERR peer
Dbasql interview questions
Summary of 2022 SQL classic interview questions (with analysis)
接口测试实战项目03:执行测试用例
mysql可以定时导出表格吗?
Revolution of game assets
Flink real-time warehouse DWD layer (Kafka associated with MySQL lookup join) template code