随笔分类 -  JS

摘要:第一步:下载pdf.js 下载地址:https://www.jsdelivr.com/package/npm/pdfjs-dist 打开后找到pdf.js、pdf.work.js以及cmaps路径下的全部文件,下载到本地或者直接引用其地址 实例代码 //HTML <canvas id="the-ca 阅读全文
posted @ 2020-04-13 17:28 凉生丿墨染 阅读(1661) 评论(1) 推荐(0)
摘要:var arr = [2,5,6]; var spliceItem = 5; //indexOf获取指定删除元素位置 var index = arr.indexOf(spliceItem) //利用findIndex var index= arr.findIndex((value, index, arr) => { return value == spliceItem }) if(index... 阅读全文
posted @ 2019-01-04 17:44 凉生丿墨染 阅读(2137) 评论(0) 推荐(0)
摘要:这里只列举几种简单易懂的排序方法(不喜勿喷,如有错误欢迎指出) 1、sort排序(按照字符编码的顺序进行排序) 2、冒泡排序 3、快速排序 阅读全文
posted @ 2017-10-18 13:52 凉生丿墨染 阅读(277) 评论(0) 推荐(0)
摘要:1、阻止事件的默认行为 2、阻止事件冒泡 阅读全文
posted @ 2017-10-17 14:31 凉生丿墨染 阅读(2733) 评论(0) 推荐(0)
摘要:1、内高度、内宽度: 内边距 + 内容框 element.clientWidth element.clientHeight 2、外高度,外宽度: 边框 + 内边距 + 内容框 element.offsetWidth element.offsetHeight 3、上边框、左边框 element.cli 阅读全文
posted @ 2017-10-17 14:16 凉生丿墨染 阅读(34562) 评论(1) 推荐(3)
摘要:话不多少,直接上代码 阅读全文
posted @ 2017-09-28 17:56 凉生丿墨染 阅读(486) 评论(0) 推荐(0)
摘要:一、dot.js介绍 最近用到的数据模板引擎有很多,今天讲的doT.js也是其中一种。 doT.js的特点是体积小,速度快,并且不依赖其他插件。 官网下载:http://olado.github.io/doT/index.html 二、使用方法 //1、dot模板封装function dotTemp 阅读全文
posted @ 2017-09-19 17:13 凉生丿墨染 阅读(975) 评论(0) 推荐(0)
摘要:Date.prototype.Format = function (fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小时 "m+": ... 阅读全文
posted @ 2017-09-19 16:03 凉生丿墨染 阅读(189) 评论(0) 推荐(0)
摘要:一、String常用操作 1.截取 2.拆分 3.大小写转换 二、Array数组常用操作 1.基础操作 2.常用代码 阅读全文
posted @ 2017-09-19 16:00 凉生丿墨染 阅读(336) 评论(0) 推荐(0)
摘要:if (!String.prototype.includes) { String.prototype.includes = function(search, start) { 'use strict'; if (typeof start !== 'number') { start = 0; } if 阅读全文
posted @ 2017-07-17 17:53 凉生丿墨染 阅读(437) 评论(0) 推荐(0)
摘要:Date.prototype.Format = function(fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小 阅读全文
posted @ 2017-07-17 17:52 凉生丿墨染 阅读(111) 评论(0) 推荐(0)