- 博客(4)
- 收藏
- 关注
转载 移动端的适配方案之 post-css-to-viewport
以前的适配方案const deviceWidth = document.documentElement.clientWidth || document.body.clientWidth;document.querySelector('html').style.fontSize = deviceWidth / 7.5 + 'px';新的是配方案 postcss-px-to-viewport安装到项目中:npm install postcss-px-to-viewport --save-dev
2021-06-29 16:30:52
768
转载 错误监控与处理
生产环境下对页面报错的监控和上报使用方法:window.onerrorwindow.onerror = function(message, url, line) { if (!url) return; var msg = {}; //记录客户端环境 msg.ua = window.navigator.userAgent; // 具体需的信息根据实际情况定 msg.message = message.message; msg.url = url; msg.li
2021-06-29 14:07:16
111
转载 提升效率的 JavaScript 简写技巧
提升效率的 JavaScript 简写技巧所有编程语言的简写技巧都可以帮助我们编写更加整洁和优雅的代码,以便于用更少的代码量实现目标。那么JavaScript的简写技巧有哪些呢,一起来看看吧。声明变量//普通写法 let x; let y = 20; //简写 let x, y = 20;给多个变量赋值//普通写法 let a, b, c; a = 5; b = 8; c = 12; //简写 let [a, b, c] = [5, 8, 12];分配默认值
2021-04-09 15:01:18
97
转载 数组去重
在实际工作或面试中,我们经常会遇到“数组去重”问题,接下来就是使用js实现的数组去重的多种方法:1.将数组的每一个元素依次与其他元素做比较,发现重复元素,删除 var arr = [1,23,1,1,1,3,23,5,6,7,9,9,8,5,5,5,5]; console.log(arr); //[1, 23, 1, 1, 1, 3, 23, 5, 6, 7, 9, 9, ...
2020-03-26 13:15:16
124
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人