在Vue中动态获取浏览器宽和高

今天项目中有个关于适配的要求
1.Vue项目中动态获取浏览器宽和高

mouted(){
    this.widheight= `${document.documentElement.clientHeight}`;//获取浏览器可视区域高度
     this.widwidth= `${document.documentElement.clientWidth}`;//获取浏览器可视区域高度
    let that = this;
    window.onresize = function(){
       that.widheight=  `${document.documentElement.clientHeight}`;
       that.widwidth = `${document.documentElement.clientWidth}`
    }
}

你可能感兴趣的:(在Vue中动态获取浏览器宽和高)