当前位置:网站首页>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>
边栏推荐
- Improved Pillar with Fine-grained Feature for 3D Object Detection论文笔记
- Teacher Wu Enda's machine learning course notes 02 univariate linear regression
- Flink real-time warehouse DWD layer (order placing multiple tables to realize join operation) template code
- Can MySQL export tables regularly?
- gin 中间件
- 330. 按要求补齐数组
- Vscode remote debugging PHP solution through remotessh and Xdebug
- win11VMware打开虚拟机就蓝屏重启以及启动不了的解决方案
- Basic knowledge of MySQL (high frequency interview questions)
- Leetcode-592: fraction addition and subtraction
猜你喜欢

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

微服务远程调用

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

Vmware16 create virtual machine: win11 cannot be installed

Junda technology | applicable to "riyueyuan" brand ups wechat cloud monitoring card

Excel file reading and writing (creation and parsing)

我的创业邻居们

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

Flink real-time warehouse DWD layer (transaction domain - additional purchase dimension degradation processing) template code

聊天机器人有何用处?有何类型?看完这些就明白了!
随机推荐
我的个人网站不让接入微信登录,于是我做了这个
Summary of 2022 SQL classic interview questions (with analysis)
MySQL queries are case sensitive
Thread synchronization - producers and consumers, tortoise and rabbit race, dual thread printing
Thread - thread safety - thread optimization
2D cartoon rendering - advanced skills
微服务远程调用
【Redis】Redis开发规范与注意事项
【C语言刷LeetCode】1054. 距离相等的条形码(M)
MySQL - multi table query
最新百亿量化私募名单
记 - 踩坑-实时数仓开发 - doris/pg/flink
Unity发送Post请求给GoLang服务端解析并返回
Implementation of DDP cluster distributed training under pytoch multi GPU conditions (brief introduction - from scratch)
【C语言刷LeetCode】67. 二进制求和(E)
【charles日常问题】开启charles,使用不了钉钉
基于C语言实现图书借阅管理系统
Kubernetes (五) ---------部署 Kubernetes Dashboard
[solution] error: lib/bridge_ generated. dart:837:9: Error: The parameter ‘ptr‘ of the method ‘FlutterRustB
建木持续集成平台v2.5.2发布