随笔分类 - react
摘要:range = (start, end) => { const result = []; for (let i = start; i < end; i++) { result.push(i); } return result; }; disabledDate = (current) => { ret
阅读全文
摘要:// 多行省略号样式 .type { display: -webkit-box; overflow: hidden; word-break: break-all; -webkit-box-orient: vertical; -webkit-line-clamp: 2; width: 137px; }
阅读全文
摘要:进度条图标显示百分比进度,100%显示“100%”,而非图标 “✓” 如下: 改为: <Progress trailColor={index 0?'rgba(255,134,15,0.2)':(index 1?'rgba(247,209,10,0.2)':'rgba(57,255,255,0.2)'
阅读全文
摘要:webpack的copy-webpack-plugin插件的作用是将项目中的某单个文件或整个文件夹在打包的时候复制一份到打包后的文件夹中(即复制一份到dist目录下)。 效果如下图所示: 使用方法: 给项目中添加copy-webpack-plugin插件: yarn add copy-webpack
阅读全文
摘要:在高德地图JavaScript API之后引入UI组件库的入口文件: <!--引入高德地图JSAPI --> <script src="//webapi.amap.com/maps?v=2.0&key=您申请的key值"></script> <!--引入UI组件库(1.1版本) --> <scrip
阅读全文
摘要:输入立即校验格式: <FormItem label='数据值' required={false}> {getFieldDecorator('accountValue', { validateTrigger: ['onChange', 'onBlur'], initialValue: undefine
阅读全文
摘要:/** * moment 对象 >>> 时间戳/格式化字符串 * * use case: * momentToFormatDate(moment) // 格式化为日期 * momentToFormatDate(moment, true) // 格式化为时间 * * @param moments Mo
阅读全文
摘要:import React from 'react'; import { Tabs } from 'antd'; import PropTypes from 'prop-types'; import Outline from './monitor-outline'; import Host from
阅读全文
摘要:1.声明式表单验证: <Form.Item name="username" rules={[ { required: true, message: 'Please input your Username!', }, { max: 20, message: '最长20位!', }, { min: 5,
阅读全文
摘要:confirm({ title: '确定要删除吗?', okText: 'Ok', cancelText: 'Cancel', okButtonProps: {type: ''}, cancelButtonProps: {type: 'primary'}, onOk: () => this.prop
阅读全文
摘要:1、通过 ref <Child ref="demo" /> 给子组件添加ref属性 在父组件使用 `this.refs.demo.state.xxx` 来获取子组件state里面的xxx的值 使用 `this.refs.demo.dosomthing()` 来调用子组件的dosomthing()方法
阅读全文
摘要:Uncaught Invariant Violation: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or
阅读全文
摘要:getFullTime = (timeStamp) => { let time = ''; if(timeStamp> 1640000000){ const stamp2 = new Date(timeStamp*1000); time = Moment(stamp2).format('YYYY-M
阅读全文
摘要:let indexServiceData = [ { "groupType" : "type", "typeValue" : "IMSI", "高速": 100, "国道": 199, "省道" : 111, "县道": 19 }, { "groupType" : "type", "typeValu
阅读全文
摘要:给多个手机号发送短信,要求输入多个手机号,每个手机号中间使用英文逗号分隔,并且开始第一个字母不能为逗号,最后一个也不能为逗号 正则表达式如下: ^1[3456789][0-9]{9}(,1[3456789][0-9]{9})*$ <FormItem label="短信接收手机:"> {getFiel
阅读全文
摘要:<TextArea value={this.state.textAreaValue} placeholder="请输入要查询的手机号。(一行一条,最多100条,以回车键换行)" resize="none" onChange={this.textAreaChange} /> 当用户输入一行超过40个字
阅读全文
摘要:state = {keyValue: ‘随便’,};给他给个 key = {this.state.keyValue}点击重置 this.setState({keyValue:new Date()}) 就能清空了 相当于重新渲染了一个 ,目的达到
阅读全文
摘要:当遇到antdtable表格错位的时候,看文档,文档上说的是,要设置每一列的宽度,但是已经设置了,却还是错位。后来经过查找资料,发现只要有一列不设置宽度的话,就不会再错位,因为antd会自己给最后一列分配宽度。 在这里还遇到一个问题,就是当我们给列设置的宽度不合理的话(一般情况是设置的宽度较小),也
阅读全文