一、app兼容性处理。
①、ios12以后软键盘弹起以后,软盘原占用空白位置遗留,界面不能归位问题。
document.body.addEventListener('focusin', () => {
this.isReset = false
})
document.body.addEventListener('focusout', () => {
this.isReset = true
setTimeout(() => {
if (this.isReset) {
window.scroll(0, 0)
}
}, 300)
})
②、debugger调试,javascript逆向和javascript反逆向的安全维护。
import { addListener, launch } from 'devtools-detector';
import eruda from 'eruda';
③阻止默认行为
const _onChange = async (e) => {
e.preventDefault();
};
const _onClick = async (e) => {
e.preventDefault();
e.stopProgation()
};
④ css滚动条
div::-webkit-scrollbar{
display:none;
}