安安安安安安
watch:{
screenWidth(val){
// 为了避免频繁触发resize函数导致页面卡顿,使用定时器
if(!this.timer){
// 一旦监听到的screenWidth值改变,就将其重新赋给data里的screenWidth
this.screenWidth = val
this.editorHeight = document.body.clientHeight - 62
this.timer = true
setTimeout(() => {
this.$Message.info(JSON.stringify(this.screenWidth))
this.timer = false
},400)
}
}
},
window.onresize = () => {
return this.screenWidth = document.body.clientWidth
}