请问uni 如何调用plus.camera
uniapp吧
全部回复
仅看楼主
level 2
半夜躲雨 楼主
求讲解 求demo
2019年07月11日 10点07分 1
level 1
<template>
<view>
<camera device-position="back" flash="off" @error="error" style="width: 100%; height: 300px;"></camera>
<button type="primary" @click="takePhoto">拍照</button>
<view>预览</view>
<image mode="widthFix" :src="src"></image>
</view>
</template>
<script>
export default {
data() {
return {
src:""
}
},
methods: {
takePhoto() {
const ctx = uni.createCameraContext();
ctx.takePhoto({
quality: 'high',
success: (res) => {
this.src = res.tempImagePath
}
});
},
error(e) {
console.log(e.detail);
}
}
}
</script>
2019年11月20日 09点11分 2
如果是这么简单就不会来问了[狂汗]
2021年08月05日 03点08分
赞,已学习一种方式
2021年12月21日 06点12分
真是个大明白
2022年03月08日 07点03分
level 1
uni-app 已经封装好了,可以直接用<camera>标签,结合uni.createCameraContext();方法实现拍照
2019年11月20日 09点11分 3
level 1
nima1
2019年12月05日 07点12分 4
level 1
你这是不支持App的 封个毛线
2019年12月05日 07点12分 5
1