Ant Design
duansamve
我的Web前端(React、Vue)、NodeJS......开发笔记
展开
-
用React实现一个文件管理器
import React, { Component } from 'react'import { Row, Col, Modal, Table, Upload, Button, Breadcrumb, Icon, Progress, message } from 'antd'import http from "libs/http";import "./table.module.css";export default class FileManagerTable extends Component.原创 2021-06-17 23:05:04 · 3005 阅读 · 5 评论 -
用脚手架create-react-app搭建功能完整的React项目开发环境(支持jsx+antd+router+redux+less等)及工程目录文件说明
下载脚手架:cnpm isntall -g create-react-app创建一个名为my-app的项目:create-react-app my-app安装好了之后,接下来进入这个目录:cd my-app安装依赖:npm install启动项目:npm start ...原创 2020-03-02 22:50:36 · 397 阅读 · 0 评论 -
使用create-react-app搭建TypeScript+React+Ant Design开发环境
一、使用create-react-app创建一个支持TypeScript+React的开发环境:要创建一个支持TypeScript的Create React App项目,可以运行:npx create-react-app my-app --template typescript# oryarn create react-app my-app --template typescript要将TypeScript添加到已有的Create React App项目,请先安装它:npm in原创 2020-12-06 15:55:00 · 2462 阅读 · 0 评论 -
Ant design 3.X表单一行多个组件并一齐校验
一行一个标签对应多个输入组件,这个需求很常见但在官方例子没看到合适的,因为官方建议:注意:一个 Form.Item 建议只放一个被 getFieldDecorator 装饰过的 child,当有多个被装饰过的 child 时,help required validateStatus 无法自动生成。经过摸索,证实这样写是可行的,如下:<Form.Item label={'模块'} > <Row gutte.原创 2021-07-14 21:20:37 · 1018 阅读 · 0 评论 -
怎么修改antd默认样式
一、组件中使用className:<Table rowKey="id" loading={store.isFetching} dataSource={data} pagination={false} className="fileManagerTable" scroll={{ y: 600 }}原创 2021-06-02 21:46:07 · 2659 阅读 · 1 评论 -
Ant Design 3.25.0中如何进行表单验证
index.jsx(父组件):import React from 'react'import { Row, Col, Card, Input, Button, Table, Tag, Modal, message, Tooltip } from 'antd';import moment from 'moment'import axios from 'axios'import 'moment/locale/zh-cn';import "./question.css"import Create原创 2021-04-22 21:41:29 · 354 阅读 · 0 评论 -
Ant Design RangePicker中如何动态初始化值?
import React from 'react';import { Modal, Form, Input, Button, InputNumber, Select, Checkbox, Radio, DatePicker } from 'antd';import moment from 'moment'import 'moment/locale/zh-cn';import locale from 'antd/es/date-picker/locale/zh_CN';export defaul.原创 2021-04-16 23:17:44 · 1659 阅读 · 0 评论 -
React+Ant design日期组件DatePicker设置结束时间不能小于开始时间
import React, { Component } from 'react'import { DatePicker, Button } from 'antd';import 'moment/locale/zh-cn';import locale from 'antd/es/date-picker/locale/zh_CN';export default class TimelineCom extends Component { state = { startValue:.转载 2021-04-15 22:44:23 · 2068 阅读 · 0 评论 -
Ant Design 4.14.0中穿梭框Transfer的使用
onCheckTaskForm_Name_Hot = () => { this.createTask_formRef.current.validateFields(['name', 'host']).then(data => { console.log('name和host都校验通过!'); }).catch(error => { console.log('name和host没有都校验通过!'); ...原创 2021-03-29 16:38:47 · 1885 阅读 · 0 评论 -
从create-react-app创建项目后,运行npm run eject报错解决方法
create-react-app命令创建一个react项目,运行npm run eject生成配置文件,报了下面的错:NOTE: Create React App 2+ supports TypeScript, Sass, CSS Modules and more without ejecting: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html√ Are you sure you want to eject? This a原创 2021-03-20 23:02:08 · 706 阅读 · 0 评论 -
React+Ant Design左侧二级导航菜单
package.json:{ "name": "antd-demo", "version": "0.1.0", "private": true, "dependencies": { "@ant-design/icons": "^4.2.1", "@babel/core": "7.9.0", "@svgr/webpack": "4.3.3", "@testing-library/jest-dom": "^4.2.4", "@testing-libr原创 2021-02-02 22:18:09 · 1304 阅读 · 0 评论 -
React+Ant Design 4.4.1登录及路由导航
package.json:{ "name": "antd-demo", "version": "0.1.0", "private": true, "dependencies": { "@ant-design/icons": "^4.2.1", "@babel/core": "7.9.0", "@svgr/webpack": "4.3.3", "@testing-library/jest-dom": "^4.2.4", "@testing-libr原创 2021-02-02 22:10:15 · 549 阅读 · 0 评论 -
Ant Design中普通表单验证
import React from 'react'import { Form, Button, Input, InputNumber, Select, Checkbox, Radio } from 'antd'const { Option } = Select;const { TextArea } = Input;const layout = { labelCol: { span: 8, }, wrapperCol: { span: 16.原创 2021-02-02 22:02:28 · 572 阅读 · 0 评论 -
Ant Design中Tree组件使用(包括异步加载子节点)
import React, { Component } from 'react'import { Tree } from 'antd'const { DirectoryTree } = Tree;export default class tree extends Component { state = { } /** * 树 */ getTreeData = () => { return [ {.原创 2021-02-02 22:00:44 · 5643 阅读 · 0 评论 -
Ant Design中Spin组件使用(以表格加载为例)
import React, { Component } from 'react'import { Table, Spin } from 'antd';import axios from 'axios'export default class Home extends Component { state = { selectedRowKeys: [], // 表格选择项Keys selectedRows: [], // 表格选择项Rows ta.原创 2021-02-02 21:59:08 · 6798 阅读 · 1 评论 -
React中使用Echarts
首先安装echarts和echarts-for-react,版本一定要对,package.json: "dependencies": { "echarts": "^4.9.0", "echarts-for-react": "^2.0.16", }完整代码如下:import React, { Component } from 'react'import { Card } from 'antd';import ReactEcharts from 'echarts-for-r原创 2021-02-02 21:54:36 · 634 阅读 · 0 评论 -
React Ant Design+Node.js Express+Mysql实现后端分页
home.jsximport React, { Component } from 'react'import { Table } from 'antd';import axios from 'axios'export default class Home extends Component { state = { selectedRowKeys: [], // 表格选择项Keys selectedRows: [], // 表格选择项Rows原创 2021-01-31 20:45:10 · 1419 阅读 · 0 评论 -
React Ant Design+Node.js Express+Mysql实现后端分页(带富文本编辑器)
home.jsx:import React, { Component } from 'react'import { Table, Card, Modal, Button, Form, Input, Select, notification } from 'antd'import axios from 'axios'import qs from 'qs'import { PlusOutlined, MinusOutlined } from '@ant-design/icons';// rea原创 2021-01-12 21:24:23 · 927 阅读 · 1 评论 -
解决React脚手架create-react-app中不能使用less的问题
React脚手架create-react-app不支持less,因此需要配置webpack的webpack.config.js文件。在使用React脚手架的时候,可能发现是没有webpack.config.js文件的。运行npm run eject,会多出两个目录config和scripts,此时可以在config目录下看到配置文件webpack.config.js。下载less less-loader使用 npm 或 yarn 下载均可:// 使用npm npm install les原创 2020-08-25 21:43:24 · 1004 阅读 · 2 评论 -
React+Ant Design 4.4.1+Bootstrap3路由登录
package.json:{ "name": "antd-demo", "version": "0.1.0", "private": true, "dependencies": { "@ant-design/icons": "^4.2.1", "@babel/core": "7.9.0", "@svgr/webpack": "4.3.3", "@testing-library/jest-dom": "^4.2.4", "@testing-libr原创 2020-08-20 21:10:54 · 388 阅读 · 0 评论 -
React+Ant Design 4.4.1实现左侧二级导航(可配置路由、所有路由层级可统一、可根据路由高亮菜单项、刷新时可自动展开定位到当前路由)
package.json:{ "name": "antd-demo", "version": "0.1.0", "private": true, "dependencies": { "@ant-design/icons": "^4.2.1", "@babel/core": "7.9.0", "@svgr/webpack": "4.3.3", "@testing-library/jest-dom": "^4.2.4", "@testing-libr原创 2020-08-20 20:59:23 · 1427 阅读 · 0 评论 -
React版Ant Design 4.5.4的Modal中表单验证
import React from 'react';import { Modal, Form, Input, Button, InputNumber, Select, Checkbox, Radio } from 'antd';const { Option } = Select;const { TextArea } = Input;const layout = { labelCol: { span: 5, }, wrapperCol: { .原创 2020-08-12 21:32:19 · 769 阅读 · 0 评论 -
React Ant Design 3.x/4.5.4动态获取Table选择行数据
import React from 'react'import { Row, Col, Space, Table, Button, notification, Pagination } from 'antd';import axios from 'axios'export default class TableCom extends React.Component { state = { tableData: [], selectedRowKeys: [], // Check .原创 2020-08-07 21:21:37 · 1327 阅读 · 0 评论 -
React版Ant Design 4.5.4中表单验证
import React from 'react'import { Form, Input, Button, Select } from 'antd';const { Option } = Select;const { TextArea } = Input;const layout = { labelCol: { span: 8, }, wrapperCol: { span: 16, },};const tailLayout.原创 2020-08-07 21:17:49 · 615 阅读 · 0 评论