react 使用方法

Hooks 1. forceUpdate 1 2 const [state, updateState] = React.useState(); const forceUpdate = React.useCallback(() => updateState({}), []); Class Componet 1.forceUpdate 1 this.forceUpdate();

js Event Loop 事件循环执行机制

Javascript engine list v8引擎高效原因 V8 — open source, developed by Google, written in C++ Rhino — managed by the Mozilla Foundation, open source, developed entirely in Java SpiderMonkey — the first JavaScript engine, which back in the days powered Netscape Navigator, and today powers Firefox JavaScriptCore — open source, marketed as Nitro and developed by Apple for Safari KJS — KD

go Frp 工具使用

frp使用 frp是golang开发的内网穿透工具,日常我们本地的服务由于公网ip不固定,外网无法访问,有了内网穿透工具,就可以很轻松的把我

Lerna 包管理器命令行

1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ npm install lerna -g $ mkdir lerna-demo $ cd lerna-demo && lerna init --independent # 用的默认的固定模式,vue babel等都是这个 $ cd packages $ mkdir moduleA && mkdir moduleB ... #分别进入三个

Axios 中 Cookie 操作及代码详解

1)Cookie名称,Cookie名称必须使用只能用在URL中的字符,一般用字母及数字,不能包含特殊字符,如有特殊字符想要转码。如js操作c

Classnames库代码解读

classnames库是日常工作中用来操作dom中class相关的工具函数,这里我们对它进行解读 使用 npm install classnames –save 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Lodash ToNumber

toNumber lodash中转数字函数 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

数字加减问题解决精度问题

1 2 3 4 5 6 7 8 9 10 11 function plus(num1, num2) { const num1Digits = (num1.toString().split('.')[1] || '').length; const num2Digits = (num2.toString().split('.')[1] || '').length; const baseNumber = Math.pow(10, Math.max(num1Digits, num2Digits)); return (num1 * baseNumber + num2 * baseNumber) / baseNumber; } function minus(num1, num2) { return plus(num1, -1 * num2); }