Comments (7)
1、主、子之间的路由系统是完全独立的,无法相互影响,子应用或主应用跳转一个地址后另一方不会主动响应 2、geBaseAppRouter获取的是主应用的router实例,这里是vue-router,所以跳转方式参考vue-router的文档
from micro-app.
是不是主应用的 vue-router 只能激活到某个子应用首页,不能跳转到其他的页
from micro-app.
确认下流程,目前从主应用跳转到另一个子应用具体页面:
- 判断目标子应用是否已激活
- 是:使用 microApp.router.push 跳转
- 否:使用 vue-router 先跳转目标子应用,同时下发数据通知子应用跳转到对应页面
from micro-app.
确认下流程,目前从主应用跳转到另一个子应用具体页面:
判断目标子应用是否已激活
- 是:使用 microApp.router.push 跳转
- 否:使用 vue-router 先跳转目标子应用,同时下发数据通知子应用跳转到对应页面
第一点正确,第二点vue-router直接跳转目标页面即可,子应用会根据url进行渲染的
from micro-app.
不行,子应用没激活的时候,vue-router 跳不到指定页面,路由需要特殊配置吗
import microApp from '@micro-zoe/micro-app'
import type VueRouter from 'vue-router'
interface Options {
name: string
path: string
}
export function useJumpApp({ name, path }: Options, router: VueRouter) {
console.log('跳转子应用', name, path)
if (!microApp.getActiveApps({ excludeHiddenApp: true }).includes(name)) {
console.log('子应用未激活,需先渲染')
// router.push({ name })
// microApp.setData(name, {
// type: 'route-change',
// payload: { path: path.replace('/#', '') }
// })
router.push({ path: '/vue2/#/dialog' })
} else {
console.log('子应用已激活,直接跳转路由')
microApp.router.push({ name, path })
}
}
from micro-app.
你这不是native模式,是search模式,通过设置defaultPage可以指定默认页面 https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/router?id=%e8%ae%be%e7%bd%ae%e9%bb%98%e8%ae%a4%e9%a1%b5%e9%9d%a2
from micro-app.
试出来了,vue-router 跳转前需要对路径做编码
import microApp from '@micro-zoe/micro-app'
import type VueRouter from 'vue-router'
interface Options {
name: string
path: string
}
export function useJumpApp({ name, path }: Options, router: VueRouter) {
console.log('跳转子应用', name, path)
if (!microApp.getActiveApps({ excludeHiddenApp: true }).includes(name)) {
console.log('子应用未激活,需先渲染')
router.push({ path: `/${name}?${name}=${encodeURIComponent(path)}` })
} else {
console.log('子应用已激活,直接跳转路由')
microApp.router.push({ name, path })
}
}
from micro-app.
Related Issues (20)
- css 解析RangeError: Maximum call stack size exceeded 导致样式丢失 HOT 2
- 主应用(vue3+vite)和子应用(vue2+webpack)同时改造为umd模式时,子应用的window.mount不会自动执行
- @micro-zoe/micro-app从1.0.0-rc.3升级到1.0.0-rc.5打包后报错 HOT 2
- 子应用使用 serviceWorker 出现serviceWorker 文件不加载 没法使用 不太确定是什么问题 HOT 1
- 想让子应用的弹窗在全局显示 HOT 1
- 路径自动补全导致富文本编辑器中上传的图片保存为绝对路径 HOT 1
- 导航失败,请确保子应用渲染后再调用此方法 HOT 2
- 子应用使用docx-preview插件无法预览docx文档,单独访问正常显示 HOT 3
- 子应用使用v-if切换组件,组件样式丢失
- https://zeroing.jd.com/micro-app/demo/react17 这个demo的代码在哪里可以找到呢 HOT 1
- React umi项目 子应用跳转子应用 microApp-body节点会重新刷新,导致上个路由页面的antd的message被干掉(这是message节点挂在microApp-body节点下),跳转到下个页面后就看不见message提示了 HOT 4
- 多层嵌套,第一层应用A版本是1.0.0-rc.4,子应用B版本是0.8.11,子应用B中嵌套了一个其他子应用C,挡在A中访问B中的C页面,默认不管路由怎么切换都是访问的C中默认路由,不会切换 HOT 6
- Remix SPA作为子应用接入时无法正常运行
- keep-alive app 隐藏时是否可以不进行 release effect 行为?
- 基座和子应用全是vite+vue3项目,使用iframe沙盒后,chrome浏览器仍然报错 HOT 4
- 线上部署出现问题
- 主应用跟子应用部署在同一域名和端口下报name冲突 HOT 4
- 主应用vite-vue3部署子应用也是vite-vue3,部署后没加载子应用 HOT 2
- [rawWindow] 子应用中使用的第三方库中,使用了 window.location.href = xxx 会导致错误 HOT 1
- 有没有大佬写过这种, 基座应用为vite + vue3, 多页签的应用, 多个子应用也是vite+vue3, 基座应用左侧配置, 子应用的菜单,有大佬提供demo吗, 不胜感激
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micro-app.