-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
212 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
let list = [] | ||
|
||
export const getList = () => list | ||
|
||
export const setList = (appList) => list = appList | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// 引入文件 | ||
export {default as MicroStart } from './start' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { setList } from './const/subApps' | ||
// start 文件 | ||
const registerMicroApps = (appList)=>{ | ||
// 注册到window上 | ||
// window.appList = appList | ||
setList(appList) | ||
} | ||
|
||
|
||
export default { | ||
registerMicroApps | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
export const NAV_LIST = [ | ||
{ | ||
name: '首页', | ||
status: true, | ||
value: 0, | ||
url: '/vue3/index', | ||
hash: '', | ||
}, | ||
{ | ||
name: '资讯', | ||
status: false, | ||
value: 1, | ||
url: '/react15/information', | ||
}, | ||
{ | ||
name: '视频', | ||
status: false, | ||
value: 2, | ||
url: '/react15/video', | ||
hash: '', | ||
}, | ||
{ | ||
name: '选车', | ||
status: false, | ||
value: 3, | ||
url: '/vue3/select', | ||
hash: '', | ||
}, | ||
{ | ||
name: '新能源', | ||
status: false, | ||
value: 4, | ||
url: '/vue2/energy', | ||
hash: '', | ||
}, | ||
{ | ||
name: '新车', | ||
status: false, | ||
value: 5, | ||
url: '/react17/new-car', | ||
hash: '', | ||
}, | ||
{ | ||
name: '排行', | ||
status: false, | ||
value: 6, | ||
url: '/react17/rank', | ||
hash: '', | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import router from './router' | ||
import { subNavList } from './store/sub' | ||
// 主应用引入 util 方法 | ||
import { registerApp } from './store/utils' | ||
|
||
createApp(App).mount('#micro_web_main_app') | ||
registerApp(subNavList) | ||
|
||
createApp(App).use(router).mount('#micro_web_main_app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router'; | ||
|
||
const routes = [ | ||
{ | ||
path: '/', | ||
component: () => import('../App.vue'), | ||
}, | ||
{ | ||
path: '/react15', | ||
component: () => import('../App.vue'), | ||
}, | ||
{ | ||
path: '/react16', | ||
component: () => import('../App.vue'), | ||
}, | ||
{ | ||
path: '/vue2', | ||
component: () => import('../App.vue'), | ||
}, | ||
{ | ||
path: '/vue3', | ||
component: () => import('../App.vue'), | ||
}, | ||
]; | ||
|
||
const router = (basename='')=>createRouter({ | ||
// history: createWebHashHistory(), | ||
history: createWebHistory(basename), | ||
routes, | ||
}); | ||
|
||
export default router(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
// vue2 | ||
// - http://:localhost:9080/#/ | ||
// - energy | ||
|
||
// vue3 | ||
// - http://:localhost:9081/#/ | ||
// - index | ||
// - select | ||
// react15 | ||
// - http://:localhost:9082/#/ | ||
// -/information | ||
// -/information-last | ||
// -/video | ||
// -/video-last | ||
// react17 | ||
// - http://:localhost:9083/#/ | ||
// -/login | ||
// -/new-car | ||
// -/rank | ||
|
||
// ``` | ||
|
||
// 子应用列表 | ||
export const subNavList = [ | ||
{ | ||
name:'react15', //子应用名称 | ||
activeRule:'/react15', // 激活规则 | ||
container:'#micro-container' ,// 显示的容器,唯一标识 | ||
entry:'//localhost:9082/' // 启动的入口 | ||
}, | ||
{ | ||
name:'react17', | ||
activeRule:'/react17', | ||
container:'#micro-container', | ||
entry:'//localhost:9083/' // 启动的入口 | ||
|
||
}, | ||
{ | ||
name:'vue2', | ||
activeRule:'/vue2', | ||
container:'#micro-container', | ||
entry:'//localhost:9080/' | ||
}, | ||
{ | ||
name:'vue3', | ||
activeRule:'/vue3', | ||
container:'#micro-container', | ||
entry:'//localhost:9081/' | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { MicroStart } from '../../micro' | ||
|
||
const { registerMicroApps }= MicroStart | ||
// 注册子应用 | ||
export const registerApp=(list)=>{ | ||
// 注册到微前端框架 | ||
registerMicroApps(list) | ||
} |