在原生微信小程序中,可以通过下面的设置来设置页面背景色
page {
background:'#f0f0f0'
}
但是在uni-app上,这样的设置在小程序端并没有起作用。文章来源:https://www.toymoban.com/news/detail-617198.html
原因是因为style标签上加了scoped,那么如何在使用scoped的同时又能设置page背景色呢?文章来源地址https://www.toymoban.com/news/detail-617198.html
解决方案:
<style>
page {
background-color: #f5f5f5;
}
</style>
<style lang="scss" scoped>
.container {
width: 100%;
background-color: #f5f5f5;
}
</style>
到了这里,关于uni-app小程序设置页面背景色的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!