更新记录
1.0.0(2025-07-07)
新增
平台兼容性
uni-app(4.36)
Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
- |
- |
- |
- |
- |
- |
- |
- |
- |
微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
uni-app x(4.36)
Chrome |
Safari |
Android |
iOS |
鸿蒙 |
微信小程序 |
- |
- |
- |
- |
- |
- |
// 文件:pages/index/index.vue
<button @click="onTakePhoto">静默拍照</button>
<button @click="onStartRecord">开始录像</button>
<button @click="onStopRecord">停止录像</button>
照片路径:
{{ imgPath }}
视频路径:
{{ videoPath }}
{
if (res.success) {
this.imgPath = res.imagePath || ''
uni.showToast({ title: '拍照成功', icon: 'success' })
} else {
uni.showToast({ title: '拍照失败', icon: 'none' })
}
})
},
onStartRecord() {
const plugin = uni.requireNativePlugin('silent-camera-uts')
plugin.startRecord({}, (res) => {
if (res.success) {
uni.showToast({ title: '开始录像', icon: 'none' })
}
})
},
onStopRecord() {
const plugin = uni.requireNativePlugin('silent-camera-uts')
plugin.stopRecord({}, (res) => {
if (res.success) {
this.videoPath = res.videoPath || ''
uni.showToast({ title: '录像完成', icon: 'success' })
} else {
uni.showToast({ title: '停止失败', icon: 'none' })
}
})
}
}
}
<style scoped>
.container {
padding: 40rpx;
}
.btn-group {
margin-bottom: 30rpx;
}
button {
margin-bottom: 20rpx;
}
.label {
font-weight: bold;
margin-top: 20rpx;
}
.path-text {
font-size: 24rpx;
color: #666;
word-break: break-all;
margin-bottom: 20rpx;
}
.preview-img {
width: 100%;
height: auto;
}
</style>
<!-- nvue 页面兼容:
1. script 标签不使用 lang="ts"
2. 全部写在 default 导出中(已经处理)
3. 使用标准组件:view、text、image、button
4. 使用 scoped 样式即可兼容 App-NVUE -->