我是在main.js增加了下面这段代码手动修改返回地址
/*
* 2023.3.8 增加路由守卫 使浏览器返回正确的路径
* */
router.beforeEach((to, from, next) => {
const appKeys = store.getters['user/selectKeys']; // 自己的逻辑主应用点击微应用的时候获取key
const appKey = store.getters['user/appKey']; // 获取微应用的key
const url = `/qk/${appKey}`; // qk 是我默认写死的
// 此处为主要逻辑代码
if (appKey != undefined || url != from.fullPath || appKeys != from.fullPath) {
history.state.current = from.fullPath;
history.state.back = from.fullPath;
}
next();
});