04 2021 档案

摘要:function trigger(el, type) { var e = document.createEvent('HTMLEvents'); e.initEvent(type, true, true); el.dispatchEvent(e); } 来自vue尤大总结的 阅读全文
posted @ 2021-04-21 14:42 LeoX的爬坑笔记 阅读(93) 评论(0) 推荐(0)
摘要:function polyfillBind(fn, ctx) { function boundFn(a) { var l = arguments.length; return l ? ( l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) ): fn 阅读全文
posted @ 2021-04-21 10:55 LeoX的爬坑笔记 阅读(224) 评论(0) 推荐(0)
摘要:function jsonp({url, params, cb}) { return new Promise((resolve, reject) => { window[cb] = function (data) { // 声明全局变量 resolve(data) document.body.rem 阅读全文
posted @ 2021-04-20 15:50 LeoX的爬坑笔记 阅读(56) 评论(0) 推荐(0)
摘要:function parseParam(url) { // 将浏览器地址中 ‘?’ 后面的字符串取出来 const paramsStr = /.+\?(.+)$/.exec(url)[1]; // 将截取的字符串以 ‘&’ 分割后存到数组中 const paramsArr = paramsStr.s 阅读全文
posted @ 2021-04-20 15:44 LeoX的爬坑笔记 阅读(357) 评论(0) 推荐(0)
摘要:// 防抖:const debounce = (fn, delay) => { let timer = null; return (...args) => { clearTimeout(timer); timer = setTimeout(() => { fn.apply(this, args); 阅读全文
posted @ 2021-04-20 15:41 LeoX的爬坑笔记 阅读(68) 评论(0) 推荐(0)