- vue 改变当前页面的背景色,在当前页面的JS文件里面增加下面代码 (页面背景色会变成#f7f7f7)
beforeCreate() {
document
.querySelector('body')
.setAttribute('style', 'background-color:#f7f7f7')
},
- 或者CSS里直接添加如下:(请注意不是 style scoped)
<style>
page {
background: #ebecee;
}
</style>