上一页 1 2 3 4 5 6 ··· 14 下一页

2021年9月13日

记一次编译失败与browerlist实践

摘要: 我司有个React项目用到了leaflet,然后我需要在电脑上跑这个项目。 装好依赖,结果启动时编译失败了。 和这个帖子(https://github.com/PaulLeCam/react-leaflet/issues/900)的错误一样。 ./node_modules/@react-leafle 阅读全文

posted @ 2021-09-13 22:03 fox_charon 阅读(478) 评论(0) 推荐(0) 编辑

2021年8月23日

二维数组转一维数组、对象数组互斥去重

摘要: 二维数组转一维数组: //二维数组转一维数组 function flatten(arr) { return [].concat(...arr.map(x => Array.isArray(x) ? flatten(x) : x)) } 对象数组互斥去重: //对象数组互斥去重 function ge 阅读全文

posted @ 2021-08-23 14:58 fox_charon 阅读(141) 评论(0) 推荐(0) 编辑

2021年8月20日

分享几个数组方法

摘要: 去重: //数组去重 function unique(arr) { for (var i = 0; i < arr.length; i++) { for (var j = i + 1; j < arr.length; j++) { if (arr[i] == arr[j]) {//第一个等同于第二个 阅读全文

posted @ 2021-08-20 11:05 fox_charon 阅读(46) 评论(0) 推荐(0) 编辑

2021年8月19日

前端生成图形验证码

摘要: 代码: // 生成随机字符图片 function draw(show_num) { var canvas_width = document.getElementById("canvas").clientWidth; var canvas_height = document.getElementByI 阅读全文

posted @ 2021-08-19 11:33 fox_charon 阅读(396) 评论(0) 推荐(0) 编辑

rem自适应布局,移动版

摘要: 代码: (function(baseFontSize, designWidth) { document.documentElement.style.fontSize = (document.documentElement.clientWidth * baseFontSize) / designWid 阅读全文

posted @ 2021-08-19 11:14 fox_charon 阅读(27) 评论(0) 推荐(0) 编辑

2021年8月11日

Appcan踩坑:IOS系统下开启键盘后顶部输入框掉下来了

摘要: 经过初步排查,发现几个现象: 1 只在页面总长度超过屏幕长度时发生。 2 只在开启键盘时发生。 3 只在固定定位的页面顶部输入框获取焦点(focus)时发生。 4 只在屏幕有滚动时发生。 缺陷有两个现象: 1 顶部DOM掉下来了,在大约屏幕中间的位置。 2 此时如果继续滚动屏幕,顶部DOM不会再维持 阅读全文

posted @ 2021-08-11 20:34 fox_charon 阅读(144) 评论(0) 推荐(0) 编辑

2021年7月8日

Ant Design Pro V5 - jest 单元测试踩坑记录

摘要: 1 Cannot find module '@/components/Footer' from 'src/pages/user/Login/index.jsx' jest.config.js加上moduleNameMapper可解决。 参考:https://stackoverflow.com/que 阅读全文

posted @ 2021-07-08 20:49 fox_charon 阅读(1655) 评论(2) 推荐(0) 编辑

web前端单元测试入门,以Ant Design Pro为例

摘要: 单元测试做什么 编写用来做单元测试的js文件,并执行。 适合对谁做: 存放静态方法的js文件,如utils/utils.js 页面组件,即React Component 不适合对谁做: 模板自带的js文件(不需要做改动,而且这种一般跑单测会有问题) 单元测试文件的特点: 一般有特定名称,如*.tes 阅读全文

posted @ 2021-07-08 19:50 fox_charon 阅读(868) 评论(0) 推荐(0) 编辑

2021年6月5日

怎样固定依赖的依赖的依赖的版本

摘要: 前言 说到 package.json 的版本固定,你或许会想到 dependencies devDependencies 。 "@ant-design/pro-layout": "^4.5.16", "@antv/data-set": "^0.10.2", "antd": "^3.23.6", "c 阅读全文

posted @ 2021-06-05 15:05 fox_charon 阅读(2809) 评论(0) 推荐(1) 编辑

2020年12月15日

react-leftlet 实战:一个demo

摘要: 直接上代码。 import React, {PureComponent} from 'react'; import {useState, useEffect, useRef, useMemo} from 'react'; import { connect } from 'dva'; import { 阅读全文

posted @ 2020-12-15 23:24 fox_charon 阅读(312) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 14 下一页

导航