vue 获取屏幕宽高 width height

函数封装:

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

.

原文地址:https://www.cnblogs.com/crazycode2/p/8905878.html