vue-router使用$router.push(),頁面掛起進入debug模式,提示Uncaught (in promise) undefined

問題

vue-router使用$router.push()跳轉頁面時,頁面掛起進入debug模式,提示Uncaught (in promise) undefined,斷點進入

function (err) {
      if (onAbort) {
        onAbort(err);
      }
     ……
}

此方法
在這裏插入圖片描述

分析(待補充完善……)

Uncaught (in promise) undefined,未捕獲的promise,因爲應用程序實際上沒有生成任何錯誤。它只是一個導航($router.push),在beforeEnter鉤子中生成重定向(next(’/ foo’))

解決

1.使用route-link to bar代替$push

   <router-link to="/settlement_manage/account">
       <el-button :disabled="loading" size="mini" type="warning">
            查看詳情
        </el-button>
   </router-link>

2.對所有調用進行push更新:

    this.$router.push({
        path: '/settlement_manage/account',
    }, () => {});
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章