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

fix(vue3-bridge): vue3-bridge parameter lossing issue #3462

Merged
merged 3 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/afraid-planets-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/bridge-vue3': patch
---

fix(vue3-bridge): bridge-vue3 parameter lossing issue
2 changes: 1 addition & 1 deletion apps/router-demo/router-host-2000/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const App = () => {
path="/remote2/*"
Component={() => <Remote2App style={{ padding: '20px' }} />}
/>
<Route path="/remote3/*" Component={() => <Remote3App />} />
<Route path="/remote3/*" Component={() => <Remote3App test="123" />} />
<Route path="/memory-router/*" Component={() => <Wraper3 />} />
<Route
path="/remote-render-error/*"
Expand Down
9 changes: 9 additions & 0 deletions apps/router-demo/router-remote3-2003/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@
</template>

<style scoped></style>

<script lang="ts" setup>
interface Props {
test?: string;
}

const props = defineProps<Props>();
console.log('props', props);
</script>
11 changes: 6 additions & 5 deletions apps/router-demo/router-remote3-2003/src/export-app.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createApp } from 'vue';
import App from './App.vue';
import './index.css';
import router from './router';
import { createBridgeComponent } from '@module-federation/bridge-vue3';
import './index.css';

export default createBridgeComponent({
rootComponent: App,
appOptions: () => ({
router,
}),
appOptions: ({ app }) => {
// Optional: adding a plugin to the new Vue instance on the host application side
// app.use(customPlugin);
return { router };
},
});
8 changes: 5 additions & 3 deletions packages/bridge/vue3-bridge/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export function createBridgeComponent(bridgeInfo: ProviderFnParams) {
__APP_VERSION__,
async render(info: RenderFnParams) {
LoggerInstance.debug(`createBridgeComponent render Info`, info);
const app = Vue.createApp(bridgeInfo.rootComponent);
const { moduleName, dom, basename, memoryRoute, ...propsInfo } = info;
const app = Vue.createApp(bridgeInfo.rootComponent, propsInfo);
rootMap.set(info.dom, app);

const beforeBridgeRenderRes =
Expand All @@ -43,8 +44,9 @@ export function createBridgeComponent(bridgeInfo: ProviderFnParams) {

const bridgeOptions = bridgeInfo.appOptions({
app,
basename: info.basename,
memoryRoute: info.memoryRoute,
basename,
memoryRoute,
...propsInfo,
...extraProps,
});

Expand Down
Loading