页面中写的
执行的方法
step() {
// 这个判断用来解决这种情况,当用户没有上一条路由的历史记录,出现点击返回按钮没有反应时,下面的代码用来判断有没有上一条路由的历史记录 如果没有则返回首页
if (window.history.length <= 1) {
this.$router.push({ path: "/home" });
return false;
} else {
this.$router.go(-1);
}
}