我在某個子路由內使用了一個this.$router.push,並且確保這個地址被註冊了,但是卻無法跳轉。
this.$router.push({path:'/1'}).catch(error => {
if (error.name !== "NavigationDuplicated") {
throw error;
}
});
錯誤是我從沒見過的: ChunkLoadError: Loading chunk 5 failed
。後來發現問題是我路由模式設置成了history,但是後端卻沒有進行相應的設置,註釋掉即可。
參考鏈接:https://juejin.im/post/5ceedf8ff265da1b80202841
(寫的是history的後端配置)