Arki 的每日 BUG 观察
41 subscribers
78 photos
1 video
3 files
228 links
分享每天写的bug
以前端为主
Download Telegram
#js
用于混淆代码的一个手段
利用 FunctiontoString 检测代码是否被格式化过

// 随便定义一个函数
const f = function() {
return true
}

---

console.log(f)
"function() {
return true
}"

压缩后的代码是没有换行的,利用这个特点可以判断代码是否(正在)被修改

思路来源
https://www.v2ex.com/t/597018
#js
chrome 不支持小于 12px 的 font-size,但是 safari 支持

BOOM!!!
Forwarded from Alex wang
#js
不愧是 js。。。
#js #vue

通过在写一个的vnode组件的方式简单地在 vue 实现渲染属性
<div>
<vnode :vnode="value"/>
</div>

{
components: {
Vnode: {
functional: true,
render: (h, ctx) => ctx.props.vnode
}
},
props: ['value']
}


https://stackoverflow.com/questions/49352525/can-you-render-vnodes-in-a-vue-template
#ts

styled-components 的 type 包 @types/styled-components 在 v.4.1.9 依赖了 @types/react-native ,导致全局类型冲突,结果就是使用了这个包的大部分项目 tsc 会打出 19 个类型冲突的错误

解决方案(都不太好

1. 降级使用 @types/styled-components@v4.1.8
2. tsconfig设置 types 手动指定类型目录

围观地址(半年了还没修QAQ
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33311
#css

width: 100vw; 会有水平滚动条

解决方案

width: 100vw;
max-width: 100%;
一个用于生成图片占位符的网站,可以用于临时的布局测试使用

https://placeholder.com/
#npm
为 shell 开启 npm 的 tab 命令补全
// npm completion >> ~/.bashrc
npm completion >> ~/.zshrc


https://docs.npmjs.com/cli/completion
#mac
mac 升级到 catalina 之后 git 报错
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun


解决方法很简单,运行以下命令更新即可
xcode-select --install


https://stackoverflow.com/questions/52522565/git-is-not-working-after-macos-update-xcrun-error-invalid-active-developer-pa
#python

python 中对 bytes 取反的正确姿势
b = bytes([~ b & 0xFF])


不进行 & 操作的话位数会太长
https://stackoverflow.com/questions/28361323/python3-byte-level-bit-operations