Tencent / wujie

极致的微前端框架
https://wujie-micro.github.io/doc/
Other
4.15k stars 596 forks source link

在主应用和子应用都是hash路由模式下,来回切换子应用,路径乱掉了,却不影响跳转,咋回事 #441

Open zhang1024899756 opened 1 year ago

zhang1024899756 commented 1 year ago

主应用路由代码

import {
  createRouter,
  createWebHashHistory
} from 'vue-router'

import Vue2 from "@/views/Vue2.vue"

import Vue3 from "@/views/Vue3.vue"

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: () => import('@/layout/index.vue'),
      children: [
        {
          path: "/vue2",
          name: "vue2",
          component: Vue2,
        },
        {
          path: "/vue3",
          name: "vue3",
          component: Vue3,
        },
      ]
    }
  ]
})

来回切换两个子应用路径会乱掉 http://localhost:9528/?vue3=%2F%23%2F#/vue3

screenshot-20230315-173207

BestJarvan commented 1 year ago

官方文档有解释,开启了路由同步

zeeklog commented 1 year ago

路由同步的方案目前不是很成熟, 请考虑关闭路由同步