x icon indicating copy to clipboard operation
x copied to clipboard

与 umi max 集成后,组件无法使用

Open yudar1024 opened this issue 9 months ago • 2 comments

重现步骤

在线示例链接:(必填)

步骤: 1.使用 pnpm create umi 生成基础代码,选择 ant design pro,其他选项使用 pnpm , taobao 2.添加一个任意页面

import {
  // 消息气泡
  Bubble,
  // 发送框
  Sender,
} from '@ant-design/x';
import React from 'react';

const messages = [
  {
    content: 'Hello, Ant Design X!',
    role: 'user',
  },
];

const Conversation: React.FC = () => {
  return (
    <div>
      <Bubble.List items={messages} />
      <Sender />
    </div>
  );
};

export default Conversation;

umirc 内容如下

import { defineConfig } from '@umijs/max';

export default defineConfig({
  antd: {},
  access: {},
  model: {},
  initialState: {},
  request: {},
  layout: {
    title: 'AI 模型超市',
  },
  routes: [
    {
      path: '/',
      redirect: '/home',
    },
    {
      name: '首页',
      path: '/home',
      component: './Home',
    },
    {
      name: '权限演示',
      path: '/access',
      component: './Access',
    },
    {
      name: ' CRUD 示例',
      path: '/table',
      component: './Table',
    },
    {
      name: ' 第一个页面',
      path: '/fistpage',
      component: './firstpage',
    },
    {
      name: 'AI Conversation',
      path: '/conversation',
      component: './conversation',
    },
  ],
  styledComponents: {},
  npmClient: 'pnpm',
});

当前行为

Image

预期行为

正常显示组件

上下文

No response

版本

1.05

您在哪些浏览器上遇到了这个问题?

Chrome

yudar1024 avatar Mar 13 '25 06:03 yudar1024

需要安装antd 5.20.3以上的版本,可以check下环境

pokerface9830 avatar Apr 01 '25 03:04 pokerface9830

@yudar1024 看下 npm 安装日志里关于 peerDeps 的提醒。

afc163 avatar Apr 01 '25 05:04 afc163