vue 获取屏幕宽高 width height

/**
 * 获取屏幕宽高
 */
Vue.prototype.getViewportSize = function(){
  return {
    width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
    height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
  };
};

 

posted @ 2020-07-09 17:32  缘琪梦  阅读(2442)  评论(0编辑  收藏  举报