上一页 1 2 3 4 5 6 7 ··· 15 下一页

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 阅读(428) 评论(0) 推荐(0)

rem自适应布局,移动版

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

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

2021年8月11日

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

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

posted @ 2021-08-11 20:34 fox_charon 阅读(181) 评论(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 阅读(1861) 评论(2) 推荐(0)

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

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

posted @ 2021-07-08 19:50 fox_charon 阅读(1001) 评论(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 阅读(4779) 评论(1) 推荐(2)

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 阅读(369) 评论(0) 推荐(0)

2020年12月9日

react-leaflet 实战:Marker Popup 改成触摸触发

摘要: 如果你在 Marker 里面加一个 Popup 。 这个东西会自动加一个点击出现的事件。 而我想改成鼠标放上去出现,离开时消失。 上代码。(请粘贴到 https://react-leaflet.js.org/ 的编辑器中查看) const position = [51.505, -0.09] fun 阅读全文

posted @ 2020-12-09 23:42 fox_charon 阅读(569) 评论(0) 推荐(0)

antd实战:静态的checkbox

摘要: 就是说,这个checkbox只是展示一个勾勾,不需要做交互。 上代码。 const { Checkbox } = antd; function onChange(e) { console.log(`checked = ${e.target.checked}`); } ReactDOM.render( 阅读全文

posted @ 2020-12-09 21:33 fox_charon 阅读(261) 评论(0) 推荐(0)

2020年12月8日

antd实战:只有最下一级可以选择且只能单选的树组件

摘要: 上代码。 const { Tree } = antd; const { TreeNode } = Tree; const treeData = [ { title: '0-0', key: '0-0', children: [ { title: '0-0-0', key: '0-0-0', chil 阅读全文

posted @ 2020-12-08 22:52 fox_charon 阅读(2756) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 15 下一页

导航