随笔分类 - JavaScript
学习笔记
JS获取URL字符串中的参数
摘要:// 获取完整的URL字符串 var url = window.location.href; // 获取URL字符串中的参数部分 var params = url.split('?')[1]; // 将参数部分按照&符号分割成数组 var paramsArray = params.split('&'
阅读全文
前端实现页面/嵌套iframe右键禁用
摘要:页面: document.oncontextmenu = function(e){return false}; 嵌套iframe:iframe中要对contentDocument禁用 // 先获取到iframe iframe.contentDocument.oncontextmenu = funct
阅读全文
JavaScript获取两个数组的差集
摘要:const arra = ['a', 'b', 'c', 'd', 'e']; const arrb = ['b', 'e']; console.log("some: " + arra.filter(v => !arrb.some((item) => item v))); console.log("
阅读全文
JS获取cookie及获取不到的问题
摘要:1.下载依赖 npm i js-cookie -S 2.引入使用 import Cookies from 'js-cookie' // 创建一个在整个网站上有效的Cookie Cookies.set('name', 'value'); // 创建一个从现在起7天后过期的cookie,在整个站点上有效
阅读全文
JS去除富文本编辑器的标签获取纯文本
摘要:replaceData(value) { if (value) { return value.replace(/<[^>]+>/g, '').replace(/ /ig, '').replace(/\s/g, '') } else { return '' } }
阅读全文
JS 中将GST格式时间转为YY- MM -DD hh:mm:ss格式
摘要:function time(d) { var dateS = d.split(" "); var strGMT = dateS[0] + " " + dateS[1] + " " + dateS[2] + " " + dateS[5] + " " + dateS[3] + " GMT+0800";
阅读全文
XMLHttpRequest 中 blob类型数据转text
摘要:XMLHttpRequest 中 blob类型数据转text
阅读全文
页面的重绘(repaint)与回流(reflow)
摘要:页面的重绘(repaint)与回流(reflow)
阅读全文
树结构,当节点的children为空时,删除children
摘要:树结构,当节点的children为空时,删除children
阅读全文
JavaScript将DOM对象转换成字符串
摘要:JavaScript将DOM对象转换成字符串
阅读全文
Javascript 中 this 的指向
摘要:Javascript 中 this 的指向
阅读全文
日期格式2019-08-18T16:00:00.000Z 转换 2019-08-19 00:00:00
摘要:日期格式2019-08-18T16:00:00.000Z 转换 2019-08-19 00:00:00
阅读全文