我尝试在创建的React应用程序中使用antd。
我通过以下方式在项目中安装了antd。
yarn add antd
使用antd的按钮组件添加了一个按钮
import React, { Component } from 'react';
import Button from 'antd/lib/button';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<Button type="primary">Button</Button>
</div>
);
}
}
export default App;
不过,按钮仍未正确呈现。检查元素时,我发现应用了 antd 类。只是 css 没有加载。
'antd/lib/button/style/css'
导入了基础 CSS。 - Kevin He