diff --git a/src/router/index.js b/src/router/index.js index b636ed3..d2e0632 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -520,7 +520,12 @@ router.beforeEach(async (to, from, next) => { }); // 全局后置守卫:每次路由切换后执行 -router.afterEach(async () => { +router.afterEach(async (to) => { // 接收to参数获取当前路由信息 + // 判断当前路由是否是登录页,如果是则直接返回不执行后续逻辑 + if (to.path === '/login') { + return; + } + try { // 执行/getMessage请求 const newMessageRes = await API({ diff --git a/src/views/home.vue b/src/views/home.vue index be89c7f..fc9ce6d 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -99,6 +99,9 @@ const messageVisible = ref(false) const openMessage = () => (messageVisible.value = true) const closeMessage = () => (messageVisible.value = false) +const message = function () { + openMessage() +} const showPasswordDialog = ref(false) const pwdRef = ref()