📜  vue 路由器转换 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:31.090000             🧑  作者: Mango

代码示例2
// then, in the parent component,
// watch the `$route` to determine the transition to use
watch: {
  '$route' (to, from) {
    const toDepth = to.path.split('/').length
    const fromDepth = from.path.split('/').length
    this.transitionName = toDepth < fromDepth ? 'slide-right' : 'slide-left'
  }
}