Commit 55e4aaa4 authored by wanghao's avatar wanghao

1 进入管理系统 强制刷新界面调整

parent 47725fea
...@@ -126,22 +126,18 @@ export default { ...@@ -126,22 +126,18 @@ export default {
this.selectedMenu = index; this.selectedMenu = index;
}, },
goToAdmin() { goToAdmin() {
// 先跳转到目标页面 // 更可靠的刷新方法
this.$router.push('/index').then(() => { this.$router.push('/index').then(() => {
// 获取当前完整路径(包含查询参数) // 确保完全刷新,避免任何缓存
const currentUrl = window.location.href; const url = new URL(window.location.href);
const urlWithoutHash = currentUrl.split('#')[0]; url.searchParams.set('_t', Date.now());
url.searchParams.set('_r', Math.random().toString(36).substr(2));
// 添加时间戳参数
const separator = urlWithoutHash.includes('?') ? '&' : '?'; // 使用replace而不是href跳转,避免历史记录问题
const newUrl = urlWithoutHash + separator + 'refresh=' + Date.now(); window.location.replace(url.toString());
}).catch(() => {
// 跳转到新URL // 备用方案
window.location.href = newUrl; window.location.href = '/index?_t=' + Date.now();
}).catch(err => {
// 如果路由跳转失败,直接刷新当前页
console.warn('路由跳转失败,直接刷新:', err);
window.location.reload();
}); });
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment