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
  };
};

Original url: Access
Created at: 2019-12-03 11:24:33
Category: default
Tags: none

请先后发表评论
  • 最新评论
  • 总共0条评论