//窗口大小变化时候,进行刷新页面操作,防止样式混乱
var x=window.innerWidth;
 function resizeFresh(){
         if(x!=window.innerWidth){
                location.reload();
 }

<body onresize="resizeFresh()"></body>

    

 

vue中:

在computed计算属性中:

windowX(){
  var x=window.innerWidth;
  return x;
},
windowY(){
  var y=window.innerHeight;
  return y;
}
在methods中:
windowHeight(){// 适配窗口高度
  if(this.windowX!=window.innerWidth || this.windowY!=window.innerHeight){
    location.reload()
  }
 }
 
在mounted中:
  this.windowHeight();// 适配窗口高度
window.onresize=function(){
  self.windowHeight();//调节轮播图盒子高度
};

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-12-15
  • 2021-09-17
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-07
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2022-01-28
  • 2021-05-24
相关资源
相似解决方案