随笔分类 - 【前端】JS/ES6笔记
摘要://柯里化函数 //request.js文件 const getOperateApi = apiName => curIndex =>para=> { switch (+curIndex) { case 1: apiName = 'ChosenChannel_' + apiName//每日精选活动商
阅读全文
摘要:一、 1、Foo是一个函数,那么它会有一个显示原型对象:Foo.prototype Foo.prototype来自哪里 答案:创建了一个函数,Foo.prototype={constructor:Foo} 2、Foo是一个对象,那么它会有一个隐式原型对象:Foo.__proto__ Foo.__pr
阅读全文
摘要://寄生式继承:对象继承对象 function createObject(o) { function Fn() {} Fn.prototype = o; return new Fn(); } function inheritPrototype(SubType, SuperType) { /**社区的
阅读全文
摘要:function whCompose(...fns) { let length = fns.length; for (let i = 0; i < length; i++) { if (typeof fns[i] !== 'function') { throw new TypeError('Expe
阅读全文
摘要:function whCurrying(fn) { return function curried(...args1) { if (args1.length >= fn.length) { return fn.apply(this, args1); } else { return function
阅读全文
摘要:let delay = 5000; let timerId = setTimeout(function request() { ...发送请求... if (request failed due to server overload) { // 下一次执行的间隔是当前的 2 倍 delay *= 2
阅读全文
摘要:function makeCounter() { // 不需要这个了 // let count = 0 function counter() { return counter.count++; }; counter.count = 0; return counter; } let counter =
阅读全文
摘要:Object.entries 返回键/值对数组:[ ["name","John"], ["age", 30] ]。这就是 Map 所需要的格式 let obj = { name: "John", age: 30 }; let map = new Map(Object.entries(obj)); a
阅读全文
摘要:encryptPhone(phone) { return phone.replace(/^(\d{3})(\d{4})(\d{4})$/g, "$1****$3"); } ``
阅读全文
摘要:https://www.cnblogs.com/fifteen718/p/9533918.html if (value.match(/^\s*$/)) return 0;
阅读全文
摘要:退出按钮 <li class="iconfont icon-tuichu" @click="close"> <span>退出</span> </li> close() { Object.keys(localStorage).forEach((item) => item.indexOf('cookie
阅读全文
摘要:https://www.cnblogs.com/lingdu87/p/9592320.html
阅读全文
摘要:js数组方法整理:https://www.cnblogs.com/zyfeng/p/10541133.html
阅读全文
摘要://formatData.js //封装的formatDate函数 export function formatDate(date, fmt) { if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '
阅读全文
摘要://network文件夹下的detail.js文件 //export导出,constructor构造器里面可以放一些参数 1 export class Goods { 2 constructor(itemInfo, columns, services) { 3 this.title = itemIn
阅读全文
摘要:function(...args){ } function sum(...theArgs) { return theArgs.reduce((previous, current) => { return previous + current; }); } console.log(sum(1, 2,
阅读全文
摘要:一、防抖函数 1.封装防抖函数后进行使用 mounted() { //接收debounce返回来的函数 //this.$refs.scroll.refresh不能加(),因为要传进一个函数,加入括号变成了接收函数内部的值 const refresh = this.debounce(this.$ref
阅读全文

浙公网安备 33010602011771号