摘要: vue项目中,前端与后台进行数据请求或者提交的时候,如果后台没有设置跨域,前端本地调试代码的时候就会报“No 'Access-Control-Allow-Origin' header is present on the requested resource.” 这种跨域错误。 要想本地正常的调试,解 阅读全文
posted @ 2019-01-08 15:22 super_素素 阅读(1054) 评论(0) 推荐(1) 编辑
摘要: 防抖的应用 function debounce(fn,delay) { let timer return function() { clearTimeout(timer) var args = arguments timer = setTimeout(function() { fn(args) }, 阅读全文
posted @ 2020-10-28 14:45 super_素素 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-10-28 11:12 super_素素 阅读(55) 评论(0) 推荐(0) 编辑
摘要: https://juejin.im/post/5eef7799f265da02cd3b82fe#heading-22 阅读全文
posted @ 2020-07-21 14:25 super_素素 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 当任务函数执行next的时候,跳转到下一个任务函数class Task { constructor() { this.taskIndex = 0 this.taskList = [] this.stopRun = false } add(fn,context, ...args) { const ne 阅读全文
posted @ 2019-08-28 17:16 super_素素 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 一、原型继承 缺点:1、不能给父级构造函数传参 2、父级构造函数中引用类型的数据,会被自己构造函数实例共享 ps:这是下面实例中的2只猫,是不是萌萌哒! 这是小7 这是8哥 二、借用构造函数继承 缺点:无法继承原型中的方法 三、组合继承 完美的解决了前面2种方式造成的缺陷,但是我们会发现构造函数的属 阅读全文
posted @ 2019-07-30 15:06 super_素素 阅读(208) 评论(1) 推荐(1) 编辑
摘要: 一、cookie 1、cookie是用户访问服务器,服务器返回给客户端的一个身份id,之后每次请求,cookie都会被携带在请求头中发送给服务器。【通俗讲就是第一次访问的时候, 服务器生成一个锁芯(session)然后把开这个锁的钥匙(cookie)返回给客户端,之后用户每次访问服务器都会携带钥匙去 阅读全文
posted @ 2019-07-24 18:55 super_素素 阅读(601) 评论(0) 推荐(0) 编辑
摘要: 一、利用对象键唯一的特性(也是性能比较高的方法) 二、es6的new Set() 三、filter()(性能最低) ps:这3种是比较常见并且写起来比较简洁的,还有很多方法,比如双循环、sort等,个人觉得又绕写的又多,性能也不高,就不做介绍了。 阅读全文
posted @ 2019-07-23 16:08 super_素素 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 一、typeof判断数据类型(判断数组跟对象都返回object) 二、instanceof判断对象的原型链是否是指向构造函数的prototype var arr = [1,2,3,1]; console.log(arr instanceof Array)//true 三、对象的constructor 阅读全文
posted @ 2019-07-23 14:40 super_素素 阅读(12592) 评论(0) 推荐(1) 编辑
摘要: 一、$.extend()的用法 1.为扩展jQuery类本身,为自身添加新的方法。 $.extend({ min:((a,b) => a > b ? b : a ), max:((a,b) => a > b ? a : b ) }) $.min(3,5) //它是跟$.each一样,属于工具方法 2 阅读全文
posted @ 2019-07-22 18:02 super_素素 阅读(787) 评论(0) 推荐(1) 编辑
摘要: 最后很关键的index.html中的代码引入: 阅读全文
posted @ 2019-04-26 17:54 super_素素 阅读(4785) 评论(3) 推荐(1) 编辑