摘要: 在前端开发的过程中,我们经常会需要绑定一些持续触发的事件,如 resize、scroll、mousemove 等等,但有些时候我们并不希望在事件持续触发的过程中那么频繁地去执行函数 <div id="content" style="height:150px;line-height:150px;tex 阅读全文
posted @ 2020-05-12 15:01 府谷市民小柴 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 1、单张图片(图片动态生成) //js var xiu = new Image() xiu.src = 'http://static.igeekee.cn/scenelogo/default.png' xiu.onload = function(){ // 加载完成 } 2、单张图片(结合ES6 P 阅读全文
posted @ 2020-03-17 15:45 府谷市民小柴 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>es6 Promise</title> 6 </head> 7 <body> 8 9 </body> 10 <script type="te 阅读全文
posted @ 2020-03-09 18:10 府谷市民小柴 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 引入createDocumentFragment()方法,它的作用是创建一个文档碎片,把要插入的新节点先附加在它上面,然后再一次性添加到document中。代码如下: 代码如下: 1 //先创建文档碎片 2 3 var oFragmeng = document.createDocumentFragm 阅读全文
posted @ 2020-03-05 15:58 府谷市民小柴 阅读(419) 评论(0) 推荐(0) 编辑
摘要: 随机产生15个不想等的[0,100]之间的随机数,对这15个数从小到大排序,然后应用二分法查找34是否在这15个随机数里边 1 function random(num) { 2 var arr = [] 3 while(arr.length < num) { 4 var num = Math.flo 阅读全文
posted @ 2020-03-04 18:38 府谷市民小柴 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 首先安装 npm install xlsx html中 <input type="file" ref="upload" accept=".xls,.xlsx" class="outputlist_upload"> 引入 import XLSX from 'xlsx' 代码如下: 1 <templat 阅读全文
posted @ 2019-12-26 16:26 府谷市民小柴 阅读(1145) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>正则表达式练习</title> </head> <style> ul{ list-style: decimal; } </style> <body> <div class="reg"> <h2>正则的元字符和修饰符</h2> <h3> 阅读全文
posted @ 2019-10-14 21:10 府谷市民小柴 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 点击链接:https://mp.weixin.qq.com/s/xqwV_ELRux-R30Quo5EqbQ 阅读全文
posted @ 2019-08-26 15:48 府谷市民小柴 阅读(104) 评论(0) 推荐(0) 编辑
摘要: apply、call 区别 对于apply、call二者而言,作用完全一样,都是改变函数this的指向,只不过接收的参数不一样。 通过如下调用: bind bind方法与apply和call相似,也是可以改变函数内的this指向。 bind方法会创建一个新函数,称为绑定函数,需要调用才能执行。 这里 阅读全文
posted @ 2019-08-13 17:07 府谷市民小柴 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 手动写ajax 阅读全文
posted @ 2019-07-31 19:54 府谷市民小柴 阅读(377) 评论(0) 推荐(0) 编辑