perf: 优化路由重复提示的报错

This commit is contained in:
kuaifan 2022-03-23 10:21:17 +08:00
parent 6fba94594b
commit 2bd077136f

View File

@ -82,9 +82,9 @@ router.afterEach(() => {
Vue.prototype.goForward = function(location, isReplace) {
if (typeof location === 'string') location = {name: location};
if (isReplace === true) {
app.$router.replace(location).then(() => {});
app.$router.replace(location).then(() => {}).catch(() => {});
} else {
app.$router.push(location).then(() => {});
app.$router.push(location).then(() => {}).catch(() => {});
}
};
@ -94,7 +94,7 @@ Vue.prototype.goBack = function (number) {
if ($A.runNum(history['::count']) > 2) {
app.$router.go(typeof number === 'number' ? number : -1);
} else {
app.$router.replace(typeof number === "object" ? number : {path: '/'}).then(() => {});
app.$router.replace(typeof number === "object" ? number : {path: '/'}).then(() => {}).catch(() => {});
}
};