随笔分类 -  【前端】JS/ES6笔记

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

// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css