提交 acdab888 authored 作者: xiejiang's avatar xiejiang

feat: 新增模块联邦

上级 f5d9ac8a
/* /*
* @Author: zengzhe * @Author: zengzhe
* @Date: 2024-12-27 11:54:24 * @Date: 2024-12-27 11:54:24
* @LastEditors: zengzhe * @LastEditors: xiejiang
* @LastEditTime: 2024-12-27 17:00:00 * @LastEditTime: 2025-02-04 17:52:39
* @Description: * @Description:
*/ */
import { pluginBabel } from '@rsbuild/plugin-babel' import { pluginBabel } from '@rsbuild/plugin-babel'
...@@ -56,6 +56,20 @@ export const createPlugins = () => { ...@@ -56,6 +56,20 @@ export const createPlugins = () => {
}) })
] ]
} }
},
moduleFederation: {
options: {
name: 'web-',
remotes: {
remote: 'remote@http://localhost:5174/remoteEntry.js'
},
shared: {
vue: {
eager: true,
singleton: true
}
}
}
} }
} }
} }
/* /*
* @Author: zengzhe * @Author: zengzhe
* @Date: 2024-12-27 11:48:34 * @Date: 2024-12-27 11:48:34
* @LastEditors: zengzhe * @LastEditors: xiejiang
* @LastEditTime: 2024-12-27 17:00:41 * @LastEditTime: 2025-02-04 17:45:08
* @Description: * @Description:
*/ */
import { resolve } from 'path' import { resolve } from 'path'
...@@ -43,6 +43,7 @@ export default defineConfig({ ...@@ -43,6 +43,7 @@ export default defineConfig({
}, },
plugins: createPlugins().plugins, plugins: createPlugins().plugins,
tools: createPlugins().tools, tools: createPlugins().tools,
moduleFederation: createPlugins().moduleFederation,
performance: { performance: {
removeConsole: true removeConsole: true
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-11 09:38:40 * @Date: 2024-11-11 09:38:40
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-11-28 15:38:43 * @LastEditTime: 2025-02-04 16:38:04
* @Description: * @Description:
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
*/ */
......
...@@ -21,6 +21,8 @@ declare namespace JSX { ...@@ -21,6 +21,8 @@ declare namespace JSX {
} }
} }
declare module 'remote/*'
/* Menu */ /* Menu */
declare namespace Menu { declare namespace Menu {
interface MenuOptions { interface MenuOptions {
......
...@@ -2,15 +2,12 @@ ...@@ -2,15 +2,12 @@
* @Author: xiejiang * @Author: xiejiang
* @Date: 2024-11-05 10:14:56 * @Date: 2024-11-05 10:14:56
* @LastEditors: xiejiang * @LastEditors: xiejiang
* @LastEditTime: 2024-12-11 18:47:47 * @LastEditTime: 2025-02-04 17:19:13
* @Description: 首页 * @Description: 首页
* Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved. * Copyright(c)2024 by 好老师教育科技有限公司 All right Reserved.
--> -->
<template> <template>
<div class="home w-full h-full"> <!-- <div class="home w-full h-full">
<!-- <div class="home-nav-bag w-full flex justify-center">
<div></div>
</div> -->
<div class="home-avatar flex items-center justify-center"> <div class="home-avatar flex items-center justify-center">
<div class="text-center"> <div class="text-center">
<p class="text-[20px] bold">{{ userInfo && userInfo.userName }},您好!</p> <p class="text-[20px] bold">{{ userInfo && userInfo.userName }},您好!</p>
...@@ -39,15 +36,18 @@ ...@@ -39,15 +36,18 @@
</p> </p>
</div> </div>
<img :src="homeImg" class="mt-[80px]" width="502" alt="" /> <img :src="homeImg" class="mt-[80px]" width="502" alt="" />
</div> </div> -->
<RemoteButton />
</template> </template>
<script setup lang="ts" name="home"> <script setup lang="ts" name="home">
import { useUserStore } from '@/stores/modules/user' // import { useUserStore } from '@/stores/modules/user'
import { useBasic } from '@/hooks/useBasic' import { useBasic } from '@/hooks/useBasic'
import homeImg from '@/assets/images/home-img.png' // import homeImg from '@/assets/images/home-img.png'
const userStore = useUserStore() // const userStore = useUserStore()
const userInfo = computed(() => userStore.userInfo) // const userInfo = computed(() => userStore.userInfo)
const RemoteButton = defineAsyncComponent(() => import('remote/home'))
const { setMenuSign } = useBasic() const { setMenuSign } = useBasic()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论