mounted () {
...
window.addEventListener('resize', this.renderResize, false)
...
},
methods: {
...
renderResize () {
let width = document.documentElement.clientWidth
let height = document.documentElement.clientHeight
if (width > height) {
alert('横屏')
}
},
...
}
网友评论