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

子应用 Ant design message 组件样式丢失 #1204

Closed
yiluzhang opened this issue May 10, 2024 · 5 comments
Closed

子应用 Ant design message 组件样式丢失 #1204

yiluzhang opened this issue May 10, 2024 · 5 comments
Labels
Need Reproduction 需要复现步骤

Comments

@yiluzhang
Copy link

问题描述

子应用 ant design message 组件样式丢失无法,正常显示。

上传截图

image

环境信息

  • micro-app版本:1.0.0-rc.5
  • 主应用前端框架&版本:"vue": "^2.6.14", "element-ui": "^2.15.12"
  • 子应用前端框架&版本:"vite": "^5.2.8", "react": "^18.2.0", "antd": "^5.16.1"
@yiluzhang
Copy link
Author

Modal, Drawer, Notification, Tooltip 等弹出式组件均正常展示。

@bailicangdu bailicangdu added the Need Reproduction 需要复现步骤 label May 10, 2024
Copy link

Hello @yiluzhang. In order to facilitate location and troubleshooting, we need you to provide a realistic GitHub repository.
您好 @yiluzhang, 为了方便定位和排查问题,我们需要您提供一个重现实例,请提供一个尽可能精简的 GitHub 仓库地址。

@yiluzhang
Copy link
Author

Hello @yiluzhang. In order to facilitate location and troubleshooting, we need you to provide a realistic GitHub repository. 您好 @yiluzhang, 为了方便定位和排查问题,我们需要您提供一个重现实例,请提供一个尽可能精简的 GitHub 仓库地址。

问题出在路由系统非 pure 模式时,子应用独自进行了路由跳转,导致 message 组件可能不显示

主应用

import Vue from 'vue'
import App from './App.vue'
import microApp from "@micro-zoe/micro-app";

microApp.start();

new Vue({
  render: h => h(App),
}).$mount('#app')
// App.vue
<template>
  <micro-app iframe name="subsys" url="http://localhost:5173/subsys" />
</template>

子应用

import React, { useEffect } from 'react';
import ReactDOM from 'react-dom/client';
import { ConfigProvider, message } from 'antd';
import zhCN from 'antd/locale/zh_CN';
import { Outlet, RouterProvider, createBrowserRouter, useNavigate } from 'react-router-dom';

let root: ReactDOM.Root;

function Page() {
  useEffect(() => {
    setTimeout(() => message.info('tip..'), 10);
  }, []);

  return <h3>刷新看看</h3>;
}

function Root() {
  const navigate = useNavigate();

  useEffect(() => {
    navigate('/subsys/page');
  }, []);

  return (
    <ConfigProvider locale={zhCN}>
      <Outlet />
    </ConfigProvider>
  );
}

const router = createBrowserRouter([
  {
    path: '/subsys',
    element: <Root />,
    children: [
      {
        path: 'page',
        element: <Page />,
      },
    ],
  },
]);

function mount() {
  root = ReactDOM.createRoot(document.getElementById('root')!);
  root.render(
    <React.StrictMode>
      <RouterProvider router={router} />
    </React.StrictMode>,
  );
}

if (window.__MICRO_APP_ENVIRONMENT__) {
  window[`micro-app-${window.__MICRO_APP_NAME__}`] = { mount, unmount: () => root.unmount() };
} else {
  mount();
}

Copy link

Since the issue was labeled with Need Reproduction, but no response in 7 days. This issue will be close. If you have any questions, you can comment and reply.
由于该 issue 被标记为需要可复现步骤,却 7 天未收到回应。现关闭 issue,若有任何问题,可评论回复。

@yiluzhang
Copy link
Author

Since the issue was labeled with Need Reproduction, but no response in 7 days. This issue will be close. If you have any questions, you can comment and reply. 由于该 issue 被标记为需要可复现步骤,却 7 天未收到回应。现关闭 issue,若有任何问题,可评论回复。

@bailicangdu 问题被自动关闭,请问我提供的复现代码无法复现问题吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Need Reproduction 需要复现步骤
Projects
None yet
Development

No branches or pull requests

2 participants