methods: { back(){ if (window.history.length <= 1) { this.$router.push({path:‘/‘}) return false } else { this.$router.go(-1) } } },
参考链接:https://segmentfault.com/q/1010000010714863
vue返回上一页面如果没有上一页面返回首页
原文:https://www.cnblogs.com/beileixinqing/p/9592313.html