<template>
<transition :name="transitionName">
<router-view></router-view>
</transition></template>const routes = [
{ path: '/home', component: home },
{ path: '/detail', component: detail },
{ path: '/order', component: order },
{ path: '/', component: home }
] watch: { '$route' (to, from) { const toDepth = to.path.split('/').length;
const fromDepth = from.path.split('/').length; this.transitionName = toDepth < fromDepth ? 'slide-right' : 'slide-left'
}
}我整个页面就一个<router-view></router-view>,是不是无法实现路由切换的时候让即将消失路由从左边消失,即将进来的路由从右边进来?
添加回答
举报
0/150
提交
取消