代码改变世界

阅读排行榜

jquery阻止事件冒泡

2016-12-21 21:52 by muamaker, 225 阅读, 收藏,
摘要: jQuery 提供了两种方式来阻止事件冒泡。 方式一:event.stopPropagation(); $("#div1").mousedown(function(event){ event.stopPropagation(); }); 方式二:return false; $("#div1").mo 阅读全文

js图片压缩

2018-02-08 14:45 by muamaker, 221 阅读, 收藏,
摘要: 选择压缩的文件 阅读全文

axios的二次封装

2017-12-28 16:07 by muamaker, 181 阅读, 收藏,
摘要: 'use strict' import axios from 'axios' import qs from 'qs' var host = "https://www.easy-mock.com/mock/5bb02bc0a0afc503f502a292/example"; axios.interceptors.request.use(config => { // loading //请求... 阅读全文

职责链模式

2017-11-13 18:48 by muamaker, 167 阅读, 收藏,
摘要: var Chain = function(fn){ this.fn = fn; this.success = null; this.error = null; this.args = []; } Chain.prototype.addNext = function(fn){ return this.success = fn; } Chai... 阅读全文

将create-react-app从javascript迁移到typescript

2021-05-21 17:05 by muamaker, 140 阅读, 收藏,
摘要: 一、删除全部的 node_modules 注意: 确保之前没有在目录下执行过 tsc --init。 如果执行过,删掉 tsconfig.json , src/ react-app-env.d.ts 这两个文件都删掉。没有更好。 二、安装模块 npm install --save typescrip 阅读全文