javascript - Ant Design 在 react js 项目中不起作用
问题描述
import React from 'react';
import styled from "styled-components";
import {Col, Row} from "antd";
const TitleBig = styled.div`
font-family: "Bebas Neue Pro";
font-size: 20px;
`;
const TitleSmall = styled.div`
font-family: "Bebas Neue Pro";
font-size: 15px;
`;
const BigContents = styled.div`
font-family: "Bebas Neue Pro";
font-size: 17px;
`;
const SmallContents = styled.div`
font-family: "Bebas Neue Pro";
font-size: 12px;
`;
const DashBoard = () => {
return (
<Row gutter={[32, 32]}>
<Col xs={24} md={12} xl={8}>
<TitleBig>Hello</TitleBig>
</Col>
<Col xs={24} md={12} xl={8}>
<TitleSmall>World</TitleSmall>
</Col>
<Col xs={24} md={12} xl={8}>
<BigContents>Hello</BigContents>
</Col>
<Col xs={24} md={12} xl={8}>
<SmallContents>World</SmallContents>
</Col>
</Row>
);
};
export default DashBoard;
在这段代码中.. Ant Design Row,Col 组件不起作用..
我第一次使用ant design..我不知道如何弄清楚..
我添加结果屏幕!
我希望你好世界在一条线上!
非常感谢您的帮助!谢谢
解决方案
代码在我看来没问题。我的猜测是您忘记在项目中添加样式表:
import 'antd/dist/antd.css'; // or 'antd/dist/antd.less'
推荐阅读
- c# - 如何在没有刚体的情况下统一处理碰撞?
- javascript - 猫头鹰旋转木马未正确显示
- python - 函数调用另一个函数。颜色系统
- keras - 如何理解和调试 keras.model.fit 中的错误?
- google-cloud-platform - 如何避免从 Cloud Function 到 Cloud SQL 的网络出口费用?
- scripting - Folder.selectDialog 在 Mac 和 Windows 上的不同行为
- nestjs - 无法使 @Get('id') 在 NestJS 教程中工作
- python - 使用python读取特定的行和列以获取csv中的金额
- javascript - 如何使用相同的功能以不同的方式切换多个文本块/按钮?
- reactjs - ReactJS - 向使用 map() 显示的项目添加删除按钮