beforeCreate() { //在页面创建之前设置body的背景色
document.querySelector('body').setAttribute('style', 'background:#F9F9F9')
},
beforeDestroy() { //在页面销毁之前移除body的属性,目的是设置的颜色只对当前页面有效
document.querySelector('body').removeAttribute('style')
},
vue项目设置某一页body的背景色
最新推荐文章于 2023-02-28 15:25:06 发布