当前位置: 首页 > 工具软件 > mobile > 使用案例 >

react中使用antd-mobile

狄鹏
2023-12-01

1.首先打开antd-mobile的官方文档

       地址:https://mobile.ant.design/docs/react/use-with-create-react-app-cn

2.在项目中安装antd-mobile 使用

        npm install antd-mobile -D

3.在项目中要用的文件中导入要使用的组件 列如在:App.js文件中

import {Button} from 'antd-mobile'
 
 
使用组件直接在组件中进行使用即可
import { Button } from 'antd-mobile'
function App() {
  return (
    <div className="App">
     1223<Button type="warning"/>
    </div>
  );
}

在src目录下的index.js中导入组件库样式

import 'antd-mobile/dist/antd-mobile.css'
 类似资料: