设置camera组件的高度随客户端变化时无效
WXML:
< camera id = 'myCamera' device-position = '{{cameraPosition}}' flash = 'off' style = 'width: 100%; height: {{windowHeight-60}}px;' > < cover-view class = 'controls' > < cover-image class = 'camera' src = '/res/img/camera.png' bindtap = 'takePhoto' /> < cover-image class = 'switchCamera' src = '/res/img/refresh.png' bindtap = 'switchCamera' /> </ cover-view > </ camera > |
JS:
await getSystemInfo().then(res => { // success that.setData({ windowWidth: res.windowWidth, }); }). catch (res => { console.log(res); }); |
在开发工具中是正常显示的高度,但在手机上不能正常显示,必须切换到其他页面或者在页面上操作某个事件,引起页面刷新才能正常显示。
3 回复
提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。