Skip to content

Commit

Permalink
fix: allow root component received props parameters in vue-bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
danpeen committed Jan 26, 2025
1 parent 74de697 commit b600888
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
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>
5 changes: 2 additions & 3 deletions packages/bridge/vue3-bridge/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ export function createBridgeComponent(bridgeInfo: ProviderFnParams) {
__APP_VERSION__,
async render(info: RenderFnParams) {
LoggerInstance.debug(`createBridgeComponent render Info`, info);
const app = Vue.createApp(bridgeInfo.rootComponent);
rootMap.set(info.dom, app);

const { moduleName, dom, basename, memoryRoute, ...propsInfo } = info;
const app = Vue.createApp(bridgeInfo.rootComponent, propsInfo);
rootMap.set(info.dom, app);

const beforeBridgeRenderRes =
await instance?.bridgeHook?.lifecycle?.beforeBridgeRender?.emit(info);
Expand Down

0 comments on commit b600888

Please sign in to comment.