直接上代码:
WXML:
<view class="container">
...
</view>
WXSS:
.container {
position: relative;
}
.container::after {
content: "";
background: url(https://example.com/bg.jpg) no-repeat center center;
background-size: cover;
opacity: 0.4;
top: 0;
bottom: 0;
left: 0;
right: 0;
position: absolute;
z-index: -1;
}