蚂蚁金服出品的UI组件库
https://mobile.ant.design/docs/react/introduce-cn
- 安装
npm install antd-mobile --save
npm install babel-plugin-import --save-dev
- 修改package.json文件,在babel下添加一段代码
"babel": {
"presets": [
"react-app"
],
//需要添加的
"plugins":[
[
"import",
{
"libraryName":"antd-mobile",
"style":"css"
}
]
]
//
}
- 使用组件
import React, {Component} from 'react';
import {
Button
} from 'antd-mobile';
export default class App extends Component {
Console() {
console.log(`按钮被点击了!`);
}
render() {
return (
<Button type='primary' onClick={() => this.Console()}>点击</Button>
)
}
}