随笔分类 -  js

摘要:call function Fn(a, b, c) { console.log(this.msg, a, b, c) } const o = { msg: 'hello, world!', fn1: function () { console.log(this.msg) } } // Fn.call 阅读全文
posted @ 2021-12-08 14:14 春风一笑 阅读(57) 评论(0) 推荐(0)
摘要:防抖 debounce 定义:函数被触发时,需要先延迟,在延迟的时间内,如果再次被触发,则取消之前的延迟,重新开始延迟。这样就能达到,只响应最后一次,其余的请求都过滤掉。某个函数在短时间内只执行最后一次。 function debounce(fn, delay, immedia = false) { 阅读全文
posted @ 2021-11-27 14:23 春风一笑 阅读(97) 评论(0) 推荐(0)
摘要:在JavaScript中,通常我们会用 typeof 来判断数据类型,但只能区分number、string、undefined、boolean、function、symbol、object这些基本类型。 对应数组、null,对象,都是统一返回 object字符串。 想要准确的返回类型,就要使用jav 阅读全文
posted @ 2021-11-24 14:07 春风一笑 阅读(281) 评论(0) 推荐(0)
摘要:css画箭头 <div> <div> <span class="arrow arrow-up"></span> </div> <div> <span class="arrow arrow-bottom"></span> </div> <div> <span class="arrow arrow-le 阅读全文
posted @ 2021-11-17 11:06 春风一笑 阅读(92) 评论(0) 推荐(0)
摘要:使用以下方法,也不用去阿里云后台设置允许跨域了 downloadIamge(imgsrc, name) { const src = `${imgsrc}?t=${new Date().getTime()}` fetch(src).then(res => { res.blob().then(myBlo 阅读全文
posted @ 2021-11-13 10:30 春风一笑 阅读(2498) 评论(1) 推荐(0)