设置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);}); |
在开发工具中是正常显示的高度,但在手机上不能正常显示,必须切换到其他页面或者在页面上操作某个事件,引起页面刷新才能正常显示。
