Vue路由判断前进后退
//注册全局方法Vue.prototype.push = (url: string, closeTransition: boolean = false) => {//前进Vue.prototype.transitionName = "slide-left";this.$router.push(url);};Vue.prototype.pop = ...
·
//注册全局方法
Vue.prototype.push = (url: string, closeTransition: boolean = false) => {
//前进
Vue.prototype.transitionName = "slide-left";
this.$router.push(url);
};
Vue.prototype.pop = (n: number = -1, closeTransition: boolean = false) => {
//后退
Vue.prototype.transitionName = "slide-right";
let path = this.$router.currentRoute.path;
if (path == "/") {
return;
}
this.$router.go(n);
};
更多推荐
已为社区贡献1条内容
所有评论(0)