Vue3+TS Day23 - vue-router、路由动画、
2021-12-16 本文已影响0人
望穿秋水小作坊
1、如何给路由切换添加动画?

2、如何给路由切换添加缓存?
- 使用
keep-alive
包裹
<router-view v-slot="props">
<transition name="why" mode="out-in">
<keep-alive>
<component :is="props.Component"></component>
</keep-alive>
</transition>
</router-view>
3、为什么要【动态的添加路由】?
- 有时候需要根据用户角色,来配置路由的内容。


4、在路由切换过程中希望做更多事情,怎么办?
- 使用 【路由守卫】


