横屏检测

关于移动端横屏的操作

禁用横屏

1
2
3
4
5
6
7
8
9
10
11
12
13
14
orientTest () {
// alert(window.orientation)
if (window.orientation) {
store.commit('setState', { key: 'popIndex', val: 5 })
}
window.addEventListener("orientationchange", function () {
// alert(window.orientation)
if (!window.orientation) {
store.commit('setState', { key: 'popIndex', val: 0 })
} else {
store.commit('setState', { key: 'popIndex', val: 5 })
}
}, false);
}