vue3之跳轉頁面時判斷是否跳轉
onBeforeRouteLeave((to, from, next) => ( if (ruleAllChange .value){ ElMessageBoxconfirm( "數據未保存,請問是否繼續跳轉?", "確認" {confirmButtonText:"確認',cancelButtonText:取消'type: "warning”} ).then(() => { next(); // 繼續跳轉 .catch(() => [ // 不跳轉 } else { next(); } })
鑽研不易,轉載請註明出處......