},
watch: { //使用watch 监听$router的变化
$route(to, from) {
//如果to索引大于from索引,判断为前进状态,反之则为后退状态
if (this. r o u t e . m e t a . e n t e r p a g e t i m e s t a m p ? t h i s . route.meta.enterpagetimestamp?this. route.meta.enterpagetimestamp?this.route.meta.enterpagetimestamp>from.meta.enterpagetimestamp:true) {
//设置动画名称
this.transitionName = ‘slide-left’;
} else {
this.transitionName = ‘slide-right’;
}
}
}
}