我正常写的camera组件。但是这个camera组件无法铺满整个屏幕。只有上面一点点。想请问这是为什么?我如果强行写camera的height:100vh,就会出现拍照人变形,自拍脸会拉的特别长,占满屏幕
代码如下:
<view class="takePhoto" hover-class="none" hover-stop-propagation="false" wx:if="{{photo}}">
<camera binderror="handleCameraError" device-position="front" flash="off" wx:if="{{authCamera}}">
<cover-view>
<cover-image class="line" src="/images/mengban.jpg"></cover-image>
</cover-view>
</camera>
<view class="error-handler" wx:if="{{!authCamera}}">
<button class="nobtn" openType="openSetting" bindopensetting="openSetting">打开相机授权</button>
</view>
</view>
js:
onShow:function(){
wx.getSetting({
success: (res)=>{
if(res.authSetting["scope.camera"]){
this.setData({
authCamera:true,
})
}else{
this.setData({
authCamera:false,
})
}
}
});
},
css:
.takePhoto{
width: 100%;
height: 100vh;
}
.takephoto camera {
width: 100%;
height: 100%;
position: absolute;
z-index: -99;
}