将查询字符串?page =附加到他们请求的文件路径的/ 404页面末尾(例如,如果他们尝试加载“ mysite.com/test/errorUrl”,则它将加载“ mysite.com/404” ?page = / test / errorUrl“)
我已经尝试过了,但是没有得到想要的东西,
let path = window.location.pathname;
if (this.router.url.substring(1, 12) != "existingUrl") {
window.location.href = "/404?page=".concat(encodeURIComponent(path))
}