有时uniapp 里在page.json里配置backgroundColor - 窗口背景色不生效,
这时我们可以手动的添加一个层,自定义一个背景,如下
<template>
<view class="dbrw">
// 背景层
<view class="background-layer"></view>
<view class="course">
// 这个标签里开始构建页面
...
</view>
</view>
</template>
<style>
.background-layer{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #F5F5F5;
z-index: 0;
}
.course{
position: relative;
z-index: 1;
}
</style>