
JavaScript
qq_41636140
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
JS 数组, 对象的增查改删(多语法对比)
数据结构横向对比, 增, 查, 改, 删数组Map与Array的对比{ let map = new Map() let array = []增 map.set('t', 1) array.push({ t: 1 }) console.info('map-array', map, array); // map-array Map(1) {"t" =...原创 2019-05-25 00:07:27 · 335 阅读 · 0 评论 -
ES6重度学习 demo实例
let 与 const// 并非真正的常量 // const 的本质: const 定义的变量并非常量,并非不可变,// 它定义了一个常量引用一个值。使用 const 定义的对象或者数组,其实是可变的。// 下面的代码并不会报错:// 创建常量对象const car = {type:"Fiat", model:"500", color:"white"}; // 修改属性:car....原创 2019-05-25 11:28:10 · 448 阅读 · 0 评论 -
Axios源码深度剖析
Axios源码深度剖析 - XHR篇axios 是一个基于 Promise 的http请求库,可以用在浏览器和node.js中,目前在github上有 42K 的star数分析axios - 目录axios项目目录结构名词解释axios内部的运作流程图工具方法简单介绍axios为何会有多种使用方式用户配置的config是怎么起作用的axios.prototype.request...转载 2019-03-16 11:06:43 · 655 阅读 · 0 评论 -
JS 算法
区间求值算法挑战我们会传递给你一个包含两个数字的数组。返回这两个数字和它们之间所有数字的和。最小的数字并非总在最前面。这边是一些提示:Math.max()Math.min()Array.prototype.reduce()sumAll([1, 4]) 应该返回一个数字。sumAll([1, 4]) 应该返回 10。sumAll([4, 1]) 应该返回 10。sumAll([5...原创 2019-05-25 12:02:11 · 181 阅读 · 0 评论 -
vue-ajax/axios请求函数封装: axios+promise
项目文件目录/src/apiajax.js/** * ajax 请求函数模块 * 返回值为promise对象 */import axios from 'axios'export default function ajax (url, data = {}, type = 'GET') { return new Promise((resolve, reject) => { ...转载 2019-04-21 09:19:49 · 378 阅读 · 0 评论 -
async/await 深度理解使用
在vue中使用eg async created () { await setTimeout(()=>{ console.log(1) },5000); }, async mounted () { console.log(2) }在vue中给created使用async await,还是会先输出2,而不是等1输出完?若想实现这个要...原创 2019-05-25 12:14:10 · 439 阅读 · 0 评论 -
Promise场景实例之图片加载
{ // 所有图片加载完再添加到页面 function loadImg(src) { return new Promise(function (resolve, reject) { let img = document.createElement('img') img.src = src img.onload = function () { ...原创 2019-05-26 09:33:11 · 619 阅读 · 0 评论 -
Vue axios封装 实现请求响应拦截
封装axios.jsimport axios from 'axios'import { baseURL} from '@/config'class HttpRequest { constructor (baseURL = baseURL) { this.baseURL = baseURL this.queue = {} // 队列中有请求时 显示loado...原创 2019-05-30 11:02:18 · 1346 阅读 · 0 评论 -
ES6 数组方法库
文章目录多维数组降维成一维数组reduce()回调flat()多维数组降维成一维数组reduce()var arr1 = [[0, 1], [2, 3], [4, 5]];var arr2 = arr1.reduce(function (a, b) { return a.concat(b)} );// arr2 [0, 1, 2, 3, 4, 5]回调优点: 多维数组也可以比如:...原创 2019-09-26 12:18:00 · 250 阅读 · 0 评论