vue3之跳轉頁面時判斷是否跳轉

vue3之跳轉頁面時判斷是否跳轉

onBeforeRouteLeave((to, from, next) => (
  if (ruleAllChange .value){
    ElMessageBoxconfirm(
      "數據未保存,請問是否繼續跳轉?",
      "確認"
      {confirmButtonText:"確認',cancelButtonText:取消'type: "warning”}
    ).then(() => {
       next();  // 繼續跳轉
     .catch(() => [
       //  不跳轉
  } else {
    next();
  }
})

  

 

 

鑽研不易,轉載請註明出處......

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章