vue设置页面背景色
mounted() {document.querySelector('body').setAttribute('style', 'background-color:#f6f6f6')},beforeDestroy() {document.querySelector('body').removeAttribute('style')...
·
mounted() {
document.querySelector('body').setAttribute('style', 'background-color:#f6f6f6')
},
beforeDestroy() {
document.querySelector('body').removeAttribute('style')
},
使用上面的方式就可以为当前页面设置背景色了,mounted()在模板渲染成html后调用,beforeDestroy()销毁实例前调用
更多推荐
已为社区贡献5条内容
所有评论(0)