更新记录
1.0.3(2024-07-02)
更新相机权限日志
1.0.2(2024-07-02)
更新demo文档
1.0.1(2024-05-09)
更新说明文档
查看更多平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | 4.4 | × | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
uni-app x
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | × | - | - |
cf-takepic
开发文档
UTS 语法 UTS API插件 UTS 组件插件 Hello UTS
先打自定义基座,然后在自定义基座基础上运行到app
调用原生拍照函数
let that = this;
//调用uts插件函数
takepic({
paramA: false,
complete(res) {
that.img = "data:image/jpeg;base64," + res.replace(/\s+/g, '');
}
})
demo页代码
<template>
<view class="content">
<view class="text-area">
<button @click="take">拍照</button>
</view>
<view class="">
<image :src="img"></image>
</view>
</view>
</template>
<script>
//引入uts插件
import {
takepic
} from "../../uni_modules/cf-takepic"
export default {
data() {
return {
img: "",
}
},
onLoad() {
},
methods: {
take() {
let that = this;
//调用uts插件函数
takepic({
paramA: false,
complete(res) {
that.img = "data:image/jpeg;base64," + res.replace(/\s+/g, '');
}
})
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>