originjs / vite-plugin-federation

Module Federation for vite & rollup
Other
2.39k stars 241 forks source link

host端如何使用remote端的pinia中的state里面的数据呢? #612

Open likang329 opened 4 months ago

likang329 commented 4 months ago

我在remote暴露了整个store,想在host端使用,在host端使用remote端中actions写的方法没有问题,但是获取state中的变量值为空,请问我该怎么把remote端的store中的变量都共享呢?

这是remote端的页面:

微信图片_20240714184201

这是host端的页面:

微信图片_20240714184209

这是remote端的暴露组件:

微信图片_20240714185104

这是host端的引入使用组件:

微信图片_20240714184237 微信图片_20240714184244
Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Title: How does the host side use the data in the state in pinia on the remote side?

He110te4m commented 2 months ago

只要 Vue 是同一个 vue , pinia 就能共享,跟模块联邦没关系,是你的 vue 不是同一个,没有 share

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


As long as Vue is the same vue, Pinia can share it. It has nothing to do with module federation. It's just that your vue is not the same one and there is no share.

905868332 commented 1 month ago

只要 Vue 是同一个 vue , pinia 就能共享,跟模块联邦没关系,是你的 vue 不是同一个,没有 share

我这边是host,引入了remote,想让remote的页面在host里边跑的时候,pinia数据展示的是host的,但是没有效果

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


As long as Vue is the same vue, Pinia can share it. It has nothing to do with module federation. Your vue is not the same one, so there is no share.

My side is the host, and remote has been introduced. When I want the remote page to run in the host, the pinia data shows the host, but it has no effect.