- Sublime Text下载地址:Download – Sublime Text
- 破解工具“Hex Fiend”下载地址:Hex Fiend, a fast and clever hex editor for macOS
- 打开Hex Fiend -> File ->[……]
JS获取浏览器宽高的兼容写法
var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
var h = window.innerHeight || document.documentElemen[……]
ios滚动列表白屏问题
移动端分页列表,在ios上滚动加载分页时候,使用scrollTop,会引起白屏问题。
看不少文章说是使用了-webkit-overflow-scrolling: touch;引起的硬件加速问题。亲测删除问题仍然存在。
1 2 3 4 5 |
this.$nextTick(() => { window.scrollTo(0, 1); window.scrollTo(0, 0); }) |
[cr[……]
处理一直显示npm WARN using –force Recommended protections disabled.的问题
使用 npm config set force false 可以消除。
兼容ios11的正则匹配
ios11不支持正则零宽断言,以字符串 $哈哈哈(sh039488)$ 为例:
不兼容写法:/\$(?<=\$).*?(?=\)\$)\)\$/g
兼容写法:/\$(.*?)\)\$/g
js正则匹配以$开头和结尾的内容,并改变颜色
1 2 3 4 5 |
let res = "$你好你好$" res = res.replace(/\$(?<=\$).*?(?=\$)\$/g, `<span onclick="((params)=>{ console.log(params) })('$&')" style="color: dodgerblue;padding: 0 5px;">$&</span>`) |
Windows中Powershell中的 rm -rf 等效命令
Remove-Item -Recurse -Force <要删除的目录>
可以简写为:
rm -r -fo <要删除目录>
sshpass 带密码登陆
brew install hudochenkov/sshpass/sshpass
sshpass -p password ssh -p port user@xxxx.xxxx.xxxx.xxxx
shell 删除文件内容Mac、Linux兼容方法
1 2 3 4 5 6 7 |
# 定义sedi数组 # Linux sed后面, 用 "-i" sedi=(-i) case "$(uname)" in Darwin*) # Mac sed后面, -i 后面多个空字符串 "" sedi=(-i "") esac |
例:删除 device.js 包含 “export default Device;”字符串的内容
1 2 |
# shell中@符号可以获取数组中所有元素 sed "${sedi[@]}" "/export default Device;/d" device.js |
移动端100vh的问题与解决方案
之所以100vh在移动端出现问题,原因大致如上图,真搞不懂,为什么总是有反人类的设计出现。
经过多方参考,实测有效的方案如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<style> :root { --vh: 1vh; } </style> <script> !(function (n, e) { function setViewHeight() { var windowVH = e.innerHeight / 100; n.documentElement.style.setProperty('--vh', windowVH + 'px'); } var i = 'orientationchange' in window ? 'orientationchange' : 'resize'; n.addEventListener('DOMContentLoaded', setViewHeight); e.addEventListener(i, setViewHeight); })(document, window) </script> |
使用:
[crayon-662ac7c75efa134133635[……]