React
不再重要
这个作者很懒,什么都没留下…
展开
-
react-echarts 转换成base64格式
import React from 'react'import ReactEcharts from 'echarts-for-react';const category = { xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { type: 'value' }, serie...原创 2021-08-24 18:28:08 · 363 阅读 · 0 评论 -
stylelint样式规范工具
1.项目根目录新增 .stylelintrc 文件2.{ "rules": { # 缩进 4 个空格 "indentation": 4, # 去掉小数点前面的 0 "number-leading-zero": "never", # 使用双引号 "string-quotes": "double", # 每个属性声明末尾都要加分号 "declaration-bl转载 2021-05-27 18:41:49 · 1848 阅读 · 0 评论 -
js ts 函数工厂
class Message { private readonly message: string; //定义 message类型 防止ts环境画红色波浪线 constructor(message: string) { this.message = message //this指向当前工厂函数顶部 与 react或者 vue 内 this 不冲突 } success(txt:string) { message.success(txt + this.message) }原创 2021-05-24 14:51:59 · 252 阅读 · 0 评论 -
react canvas 生成验证码
import React from 'react';class Code extends React.Component{ state = { code: '' //验证码 } componentDidMount () { this.createCode() } randomNum=(min, max)=>{ return Math.floor(Math.random() * (max - min).原创 2020-11-24 15:54:21 · 181 阅读 · 0 评论 -
react 上传腾讯云OSS
npm install ali-ossimport OSS from "ali-oss";let GetOssFileClient = new OSS({ secure:true, region: "你的阿里云地区", accessKeyId: "你的阿里云Id", accessKeySecret: "你的阿里云Secret", bucket: "你的阿里云仓库名",});async uploadOImg(obj){ let objItem = {uid: 0,name.原创 2020-11-09 17:50:15 · 484 阅读 · 0 评论 -
axios 设置请求超时时间
import axios from 'axios';axios.defaults.timeout = 500axios.interceptors.response.use(response => { return response}, err => { if(err.message == 'timeout of 5000ms exceeded'){ ...原创 2020-04-20 18:36:23 · 3291 阅读 · 0 评论 -
react touch 事件 页面拖动
const MIN_TOUCH_DISTENCE = 50 handleTouchStart = (e) => { this.startX = e.touches[0].clientX; } handleTouchMove = (e) => { this.endX = e.touches[0].clientX; ...原创 2020-04-20 18:08:59 · 1169 阅读 · 0 评论 -
个人整理前端规范
个人整理的比较笼统的前端规范http://showdoc.hzjuym.com/web/#/33?page_id=616原创 2020-04-20 18:06:03 · 177 阅读 · 0 评论 -
vw 和 rem 做移动端适配
// 设计稿宽度, 75var designWith = 750// 设计稿上1px对应设备上多少个单位的vw, 100vw表示设备屏幕宽度var vw = 100 / designWith// 此时的vw大小时html的font-size的大小// 同时rem单位时根据vw大大小进行计算的// 为了方便后面的尺寸计算,放大100倍,即设计稿上的100px;var font...原创 2020-02-26 17:54:20 · 211 阅读 · 0 评论 -
a标签下载图片跨域
前几天做项目的时候遇到了下载跨域的问题找到的解决办法就是 后端返回图片的文件流,然后前端使用blob()转换图片格式下载 let url = "后端返回文件流的地址" fetch(url,{method:'get',headers:{'Content-Type':'image/jpeg'}}).then( res=>res.blob().then(b...原创 2020-01-13 14:36:09 · 3054 阅读 · 0 评论 -
React Use the `defaultValue` or `value` props on select instead of setting
<label> <select onChange={this.handleChange} className="select"> { this.state.list.map( item =>{ return( ...原创 2018-12-12 18:11:03 · 5570 阅读 · 0 评论