终端设置

下载链接:https://iterm2.com/ [https://iterm2.com/]下载字体:https://github.com/tonsky/FiraCode [https://github.com/tonsky/FiraCode]设置样式:Preferences → Appearance → General → Theme → Minimal设置 status bar:Preferences → Profiles → Sessions → Status bar enable → Configure Status bar设置 status bar 位置:Preferences → ... read more

mobx

Click to run embed content: https://codesandbox.io/embed/new-dew-ec8bgmobx-react 里面,凡是使用到 mobx store 的数据的组件,均需要使用 @observer 进行装饰。即使数据是从 props 里面传进来也一样。 ... read more

移动端弹窗禁止背景滚动

import React, { Component } from 'react'; import PropTypes from 'prop-types'; import withStyle from 'react-jss'; import c from '../../utils/classnames'; const style = (theme) => ({ wrapper: { position: 'fixed', top: 0, left: 0, right: 0, bottom: 0, zIndex: 4, backgrou ... read more

iOS 上的 touch event

如果在 iOS 的 App 里面嵌套一个 webview ,并且 webview 的大小仅为屏幕的一部分,那么就会出现 手指在 webview 滑动时 滑动过快而超出 webview 窗口,这时候如果手机离开屏幕的话 webview 里面的 touchend 事件并不会被触发。代码会永远停留在 touchmove 事件上。解决方案是在 touchmove 上做个超时自动触发touchend 事件。但是有个更加神奇的事情是,如果手指停留在 webview 窗口时,此时通过 new TouchEvent('touchend') 是可以手动创建事件的。但是当手指移出 webview 窗口时,new ... read more

移动端开发调试

ANDROID CHROME REMOTE DEBUGGING Get Started with Remote Debugging Android Devices | Tools for Web Developers | Google DevelopersRemote debug live content on an Android device from a Windows, Mac, or Linux computer.[https://developers.google.com/_static/7a342985d6/images/favicon.png]https://developer ... read more

开发技巧

1. console.log.apply 后面跟的上下文必须为 console ,不能为 window 或其他,否则会抛出如下错误: Uncaught TypeError: Illegal invocation at log (<anonymous>:2:30) at <anonymous>:2:1 at Object.InjectedScript._evaluateOn (<anonymous>:905:140) at Object.InjectedScript._evaluateAndWrap (<anonymous>:838:34) at Ob ... read more

使用new Function创建函数

> Syntax new Function ([arg1[, arg2[, …argN]],] functionBody) 使用构造函数生成新实例的方式创建函数比起函数声明有以下几个特点: * 函数可动态生成 * 函数均为匿名函数, Function.name 均为 anonymous * 函数内部无法引用局部变量,只能引用全局变量 var x = 10; function createFunction1() { var x = 20; return new Function("return x;"); // this |x| refers global |x| } functio ... read more

ESXi 6.5 USB 设备直通给虚拟机之后没有起作用

1. ssh 进入 ESXi 2. 执行 esxcli system module set -m=vmkusb -e=FALSE ,该命令的作用是禁用 ESXi 6.5 新的 vmkusb 模块,改用传统的 USB 驱动。 3. 执行完成之后重启 ESXi ,USB 设备即可正常工作。 Reference: 1. https://communities.vmware.com/thread/547408 ... read more