vue后退判断是否有历史记录,有就返回上一级,否则返回指定路由
Vue.prototype.back = function (route) { if (window.history.length > 1) { this.$router.back(); } else { this.$router.push(route); } }
Vue.prototype.back = function (route) { if (window.history.length > 1) { this.$router.back(); } else { this.$router.push(route); } }