在 vue-router 中访问导航栈
rocka.me · 发布时间:2019-01-21 16:28:04
以下内容来自网站订阅源,完整文章请查看原文。
vue 提供了 组件来为组件的切换添加动画,得益于这个特性, vue-router 中的 router-view 也可以在切换路由组件时播放动画。自然的,就产生了在前进/后退时使用不同动画的需求。在 vue-router 文档的 Route-Based Dynamic Transition 一节中,提供了这样的写法:// then, in the parent component, // watch the `$route` to determine the transition to use watch: { '$route' (to, from) { const toDepth = to…