首页 前端知识 解决uniapp设置背景颜色不起效

解决uniapp设置背景颜色不起效

2024-06-17 09:06:11 前端知识 前端哥 189 948 我要收藏

1. 解决办法一: style去掉scoped

// 修改前
<style lang="scss" scoped>
page {
  background-color: #f5f5f5;
}
</style>
 
// 修改后
<style lang="scss">
page {
  background-color: #f5f5f5;
}
</style>

1. 解决办法二: 为了避免页面的样式影响到其他页面,需要保留scoped。这时可以在另外一个没有scoped的style里配置页面背景色。

// 配置页面背景色
<style lang="scss">
page {
  background: #f6f6f6;
}
</style>
// 页面的其他样式
<style lang="scss" scoped>
.filter-box {
  background-color: #fff;
  width: 750rpx;
  height: 66rpx;
}
</style>
转载请注明出处或者链接地址:https://www.qianduange.cn//article/12448.html
标签
评论
发布的文章

HTML5 新增元素

2024-06-22 10:06:20

【前端】HTML5基础

2024-06-22 10:06:36

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!