methods: {
// 判断横屏/竖屏
howArrow(){
let that = this;
function arrow() {
if (window.orientation == 180 || window.orientation == 0) {
that.screenArrow = '||| 竖屏 |||';
}
if (window.orientation == 90 || window.orientation == -90) {
that.screenArrow = '--- 横屏 ---';
}
}
window.addEventListener("load", arrow, false);
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", arrow, false);
},
},
mounted(){
this.howArrow();
},
【学习随记】js判断横竖屏
最新推荐文章于 2024-06-19 17:13:15 发布