需求

门户引擎中引入微模块

1.点击下图标红的位置,并且在脚本中添加以下代码

const { container } = EventOptions;
const { emitMicroEvent } = JE.useAdmin();
emitMicroEvent('JE_CORE_PORTAL_INIT','portal-renderer', container);
  1. 在微应用的项目的入口页面中添加
<script>
    import { defineComponent, h } from 'vue';
    import { renderVNode } from '@jecloud/ui';
    import { useMicroStore } from '@common/store/micro-store';

    export default defineComponent({
    name: 'PortalContainer',
    components: {},
    setup() {
    const microStore = useMicroStore();
    microStore.on('portal-renderer', (container, params) => {
        // JePortal是微模块的内容
        renderVNode(container, () => h(JePortal, { ...params }));
    });

    return {};
    },
    });
</script>
最后编辑: 秦永莲  文档更新时间: 2024-08-29 09:50   作者:秦永莲