上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 36 下一页
摘要: 前言 看了掘金一篇关于Vue开发相关优化技巧,确实发现以前项目中写的代码有些问题,但是无关逻辑问题,当时写的代码感觉加载编译,甚至逻辑都没有问题,但是现在想一下,确实是有一些优化方面的问题,也就是说以前写的代码的确是有一些问题的。所以看了这篇帖子,借此总结一下。 Vue开发中的一些优化方式 v-sh 阅读全文
posted @ 2020-07-26 20:37 671_MrSix 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.myReduce = function(fn,initValue){ if(this.length == 0){ throw new Error('Reduce of empty array with no initial value') } let i,total; 阅读全文
posted @ 2020-07-24 22:35 671_MrSix 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.myFilter = function(callback){ let arr = [] for(let i = 0;i < this.length;i++){ let item = this[i] if(callback(item,i,this)){ arr.push 阅读全文
posted @ 2020-07-24 21:30 671_MrSix 阅读(76) 评论(0) 推荐(0) 编辑
摘要: const EventUtils = { addEvent(element,type,handler){ if(element.addEventListener){ element.addEventListener(type,handler,false) }else if(element.attac 阅读全文
posted @ 2020-07-24 21:23 671_MrSix 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.myMap = function(callback){ let arr = new Array(this.length) for(let i = 0;i < this.length;i++){ let item = this[i] if(this.indexOf(it 阅读全文
posted @ 2020-07-24 18:09 671_MrSix 阅读(117) 评论(0) 推荐(0) 编辑
摘要: const firstBiggerThanMe = (arr = [4,9,32,1,2,5,6,6,3,8,10,9]) => { const len = arr.length const stack = [] const firstBiggerArr = new Array(len).fill( 阅读全文
posted @ 2020-07-23 17:13 671_MrSix 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 将input数据格式转换为output数据格式 let input = [{ id: 1, val: '学校', parentId: null },{ id: 2, val: '班级1', parentId: 1 },{ id: 3, val: '班级2', parentId: 1 },{ id: 阅读全文
posted @ 2020-07-23 16:41 671_MrSix 阅读(131) 评论(0) 推荐(0) 编辑
摘要: class Link{ fn(params){ console.log(params) return this } } class Link{} Link.prototype.fn = function(params){ console.log(params) return this } 第二种方式 阅读全文
posted @ 2020-07-23 16:37 671_MrSix 阅读(123) 评论(0) 推荐(0) 编辑
摘要: function longestNoRepeatStr(str){ let len = 0 if(str.length == 0 || str.length == 1){ return str.length } for(let i = 0;i < str.length - 1;i++){ let a 阅读全文
posted @ 2020-07-23 16:33 671_MrSix 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 写一个 mySetInterval(fn, a, b),每次间隔 a,a+b,a+2b 的时间,然后写一个 myClear,停止上面的 mySetInterval function mySetInterval(fn,a,b,flag = 0){ setTimeout(() => { fn(a + b 阅读全文
posted @ 2020-07-23 16:32 671_MrSix 阅读(290) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 36 下一页