js-路由动画效果,路由返回上一级history go设置
组件里面的生命周期
beforeRouteUpdate (to, from, next) {
let isBack = this.$router.isBack
if (isBack) {
this.transitionName = 'slide-right'
} else {
this.transitionName = 'slide-left'
}
this.$router.isBack = false
next()
}
router.js中的
Router.prototype.goBack = function () {
this.isBack = true
window.history.go(-1)
}
网友评论