Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native模式下,子应用内部跳转,不触发主应用的路由监听 #1432

Open
dengjunxx opened this issue Oct 30, 2024 · 3 comments
Assignees
Labels
Working on it Working on this issue

Comments

@dengjunxx
Copy link

问题描述

native模式下,子应用页面A里有个button,点击跳转到页面B,路径和页面都能改变,但是在主应用的watch和路由拦截中,都监听不到路由变化

复现步骤

1.子应用页面A里有个button,点击跳转到页面B
2.路径虽然改变了,但是在主应用的watch和路由拦截中,都监听不到路由变化

上传截图

请上传代码截图、控制台、终端等截图以帮助我们了解您的问题。

复现仓库

请提供一个精简的代码仓库,然后上传到自己的 github,以帮助我们复现您的问题。
主应用:https://gitee.com/dengjunxx/micro-app_main_demo
子应用:https://gitee.com/dengjunxx/micro-app_child_vite-vue3_demo

环境信息

micro-app版本:^1.0.0-rc.9
主应用前端框架&版本: "vue": "^3.2.45",
子应用前端框架&版本: "vue": "^2.2.45",
构建工具&版本:"vite": "^4.1.0",

@timhub66 timhub66 self-assigned this Nov 1, 2024
@dengjunxx
Copy link
Author

还有几个问题,是和这个同一个项目的,有时间也一起帮忙看看吧 @timhub66

  1. 切换成native路由,但是后退按钮有时候得点击两回才能正常后退 https://github.com/micro-zoe/micro-app/issues/1421
  2. 子应用控制台报错:Cannot read properties of null (reading 'emitsOptions') https://github.com/micro-zoe/micro-app/issues/1372

@AdonLee
Copy link

AdonLee commented Dec 3, 2024

image
@timhub66 大佬请教一下为啥只在search mode下才触发?

@Yulingsong
Copy link

Yulingsong commented Dec 13, 2024

之前遇到过,当时用的1.0.4版本,代码维度自己做了兼容

 window.onhashchange = () => {
   
  }

//监听非hash模式url变化
const currentRoute = useRoute()
watch(
  () => currentRoute.fullPath,
  (val) => {
  
  },
)

上面的要是不好使
就再加一个

microApp.router.beforeEach((to, from, appName) => {
 
})

@timhub66 timhub66 added the Working on it Working on this issue label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working on it Working on this issue
Projects
None yet
Development

No branches or pull requests

5 participants
@AdonLee @Yulingsong @dengjunxx @timhub66 and others