1.html 

 <div class="brand_zone" :style="{backgroundColor:colorList[type-1]}"></div>
2.css 
.brand_zone{
  position: fixed;
    width: 100%;
    height: 100%;
    top: 0px;
    left: 0;
    z-index: -1;
}
3.js
data(){
type:1,
colorList:['#F32446','#EF2602','#F72D93']
}

created(){
this.type = this.$route.query.type;
}

页面背景色占满了全屏,不会影响页面元素

第二种方案,(如果页面keep-alive 会导致页面颜色遗留)
mounted 
// document.body.style.backgroundColor = "#F32446";
destroyed
 document.querySelector("body").setAttribute("style", "background-color:''");

第三种:
:style="{ backgroundColor: colorList[type - 1], height: pageHeight }"

this.pageHeight = window.screen.height + "px";
 

相关文章:

  • 2021-11-12
  • 2021-08-15
  • 2021-11-17
  • 2021-10-16
  • 2021-10-17
  • 2021-12-05
  • 2019-03-04
猜你喜欢
  • 2021-10-27
  • 2021-10-17
  • 2021-12-18
  • 2021-11-23
  • 2021-11-23
  • 2021-09-17
  • 2021-10-17
  • 2021-10-21
相关资源
相似解决方案