fix(dashboard): 迁移 Vue Router navigation guard 到返回值的写法

Vue Router 4 已弃用 next() 回调,改为直接返回值
This commit is contained in:
LIghtJUNction
2026-03-27 19:09:17 +08:00
parent 0301511b1c
commit b25342303f

View File

@@ -386,7 +386,7 @@ export default {
},
// 检查未保存的更改
async beforeRouteLeave(to, from, next) {
async beforeRouteLeave(to, from) {
if (this.hasUnsavedChanges) {
const confirmed = await this.$refs.unsavedChangesDialog?.open({
title: this.tm('unsavedChangesWarning.dialogTitle'),
@@ -397,25 +397,25 @@ export default {
});
// 关闭弹窗不跳转
if (confirmed === 'close') {
next(false);
return false;
} else if (confirmed) {
const result = await this.updateConfig();
if (this.isSystemConfig) {
next(false);
return false;
} else {
if (result?.success) {
await new Promise(resolve => setTimeout(resolve, 800));
next();
return true;
} else {
next(false);
return false;
}
}
} else {
this.hasUnsavedChanges = false;
next();
return true;
}
} else {
next();
return true;
}
},
props: {