fix:ima-camera用uni.getSystemInfo动态宽高取代flex:1

This commit is contained in:
ShenQiLun 2026-06-25 17:07:52 +08:00
parent 651b3d8ec7
commit 95ff306da4

View File

@ -3,7 +3,7 @@
<!-- 相机预览 --> <!-- 相机预览 -->
<ima-camera-view <ima-camera-view
ref="cameraRef" ref="cameraRef"
style="width:750rpx;flex:1;" :style="'width:' + winWidth + 'px;height:' + winHeight + 'px;'"
flash="off" flash="off"
facing="back" facing="back"
@onPictureTaken="onPictureTaken" @onPictureTaken="onPictureTaken"
@ -49,9 +49,20 @@
return { return {
capturedList: [], capturedList: [],
cameraReady: false, cameraReady: false,
facing: 'back' facing: 'back',
winWidth: 750,
winHeight: 1334
} }
}, },
onLoad() {
var that = this
uni.getSystemInfo({
success: function(res) {
that.winWidth = res.windowWidth
that.winHeight = res.windowHeight
}
})
},
methods: { methods: {
onCameraOpened() { onCameraOpened() {
this.cameraReady = true this.cameraReady = true
@ -117,7 +128,6 @@
.cc-page { .cc-page {
flex: 1; flex: 1;
background-color: #000000; background-color: #000000;
position: relative;
} }
/* 顶部 */ /* 顶部 */
.cc-topbar { .cc-topbar {