- 当前 Bug 的表现(可附上截图)
工具调试正常,真机环境测试无法定位
- 预期表现
无法达到预期的固定定位表现
- 复现路径
- 提供一个最简复现 Demo
<view class=“mask-canvas”>
<view class=“canvas-box”>
<canvas canvas-id=“shareCanvas” class=‘canvas’ id=“shareCanvas”/>
</view>
</view>
.mask-canvas {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 20;
background-color: rgba(0,0,0,.4);
.canvas-box {
position: relative;
width: 600rpx;
height: 990rpx;
margin-left: 75rpx;
margin-top: 40rpx;
border-radius: 10rpx;
.canvas {
position: fixed;
left: 75rpx;
top: 40rpx;
right: 75rpx;
z-index: 200;
height: 900rpx;
width: 600rpx;
}
}
}
canvas 是原生组件,无法使用 fixed 定位,详情参见 https://developers.weixin.qq.com/miniprogram/dev/component/native-component.html