這段代碼可以顯示用戶瀏覽器是否為移動(dòng)端
!!navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)
返回值為布爾值
判斷移動(dòng)端橫豎屏
orient () {
if (window.orientation === 90 || window.orientation === -90) {
console.log('橫屏')
} else if (window.orientation === 0 || window.orientation === 180) {
console.log('豎屏')
}
}