更新记录
1.0.11(2025-02-26)
修复打包错误
1.0.9(2025-01-15)
1
1.0.8(2025-01-14)
1
查看更多
平台兼容性
uni-app
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
√ |
√ |
- |
- |
- |
- |
6.0 |
12 |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
uni-app x
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
6.0 |
12 |
- |
- |
依赖权限
<!-- Required for photos and videos -->
NSCameraUsageDescription
<!-- Optional for photos -->
NSMicrophoneUsageDescription
<!-- Optional for the demo app to copy the photos/videos to your photo library -->
NSPhotoLibraryAddUsageDescription
使用方法 .文件
<camera-view buttontext='2323' ref="camera" style="width: 100%;background: #111;"
:style="{height:windowHeight+'px'}" :facing='facing' :flash="0" @onPictureTaken="onPictureTaken"
takePictureSnapshot="onPictureTaken" @onVideoRecordingStart="onVideoRecordingStart"
@onVideoRecordingEnd="onVideoRecordingEnd" @onAutoFocusStart="onAutoFocusStart">
</camera-view>
支持属性说明
属性名 |
类型 |
默认值 |
说明 |
facing |
String |
front |
前置模式,有效值为 back(后置摄像头),front(前置) |
flash |
int |
0 |
0:关闭 1:开启 2:自动 3:常开 |
zoom |
float |
0-1 |
缩放比例 |
@onError |
EventHandler |
|
报错信息 |
@onPictureTaken |
EventHandler |
|
拍照返回数据 |
@onVideoRecordingStart |
EventHandler |
|
录制视频开始事件 |
@onVideoRecordingEnd |
EventHandler |
|
录制视频结束事件 |
支持方法说明(通过ref调用)
方法名 |
类型 |
参数 |
说明 |
takePicture |
method |
- |
拍照 |
takeVideo |
method |
毫秒数或不传 |
拍视频 |
stopVideo |
method |
- |
停止录相 |
close |
method |
- |
关闭相机 |
open |
method |
- |
开启相机 |
this.$refs.camera.takePicture()