data () {
return {
windowHeight: window.innerHeight
}
}
mounted () {
window.onresize = () => {
this.windowHeight = window.innerHeight
}
}
watch: {
'windowHeight': function (newVal, oldVal) {
//监听屏幕宽度变化
this.windowHeight = newVal
console.log(newVal)
}
}
VUE监听resize
猜你喜欢
转载自blog.csdn.net/yuyu_2019/article/details/111540079
今日推荐
周排行