摘要: export function getQueryString(name) { let reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i'); let r = window.location.search.substr(1).match(reg); if 阅读全文
posted @ 2021-01-27 18:14 无人问及 阅读(60) 评论(0) 推荐(0) 编辑
摘要: // 初始化 var u = new SpeechSynthesisUtterance(); // 属性设置 u.text = "我爱中国"; // 执行 speechSynthesis.speak(u); // 获取声音列表 speechSynthesis.getVoices(); // 设置声音 阅读全文
posted @ 2021-01-19 17:09 无人问及 阅读(1762) 评论(0) 推荐(0) 编辑
摘要: 将对象冻结,应该使用Object.freeze方法。 const foo = Object.freeze({}); // 常规模式时,下面一行不起作用; // 严格模式时,该行会报错 foo.prop = 123; 上面代码中,常量foo指向一个冻结的对象,所以添加新属性不起作用,严格模式时还会报错 阅读全文
posted @ 2020-12-30 15:36 无人问及 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 所以我们需要添加个判断,当不传payload的时候,action就不添加payload属性。 function createAction(type) { return (payload) => { const action = { type, }; if(payload !== undefined) 阅读全文
posted @ 2020-12-18 16:03 无人问及 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 1。head标签内引入 <script src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"></script> 2. 初始化 <script> window.ifShowVconsole = 'true' if (VConsole 阅读全文
posted @ 2020-12-15 17:00 无人问及 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 重绘和重排(回流) 重绘:给元素设置一些CSS样式,但不改变形状。比如说visibility、color、background-color、outline这些之类的就会触发重绘,重绘不会重新布局。重绘不一定重排。 重排:元素发生形状的变化,位置的变化,渲染树需要重新计算就会触发重排。像设置displ 阅读全文
posted @ 2020-12-15 10:24 无人问及 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 1 //该模块实现移动端rem布局 2 function remSize() { 3 let deviceWidth = document.documentElement.clientWidth || window.innerWidth //获取屏幕宽度 4 if (deviceWidth >= 7 阅读全文
posted @ 2020-12-15 09:59 无人问及 阅读(122) 评论(0) 推荐(0) 编辑
摘要: export function phoneFormat(phoneNumber) { if (!phoneNumber) { return null; } let tel = phoneNumber.replace(/(^\s+)|(\s+$)/g, ''); tel = tel.replace(/ 阅读全文
posted @ 2020-11-26 18:48 无人问及 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 包版本过高会引发滚动条滚动后无数据问题, 建议使用V3.4.2 阅读全文
posted @ 2020-10-30 14:23 无人问及 阅读(878) 评论(0) 推荐(0) 编辑
摘要: 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>XMLHttpRequest上传文件</title> 6 <script type="text/javascript"> 7 /* 8 三个参数 9 file: 阅读全文
posted @ 2020-10-20 09:54 无人问及 阅读(90) 评论(0) 推荐(0) 编辑