更新记录
1.0.3(2024-07-26)
一、文档纠正
1.0.2(2024-07-09)
一、 [plugin:uni:app-uts] Parse error
1.0.1(2024-07-07)
一、使用示例
查看更多平台兼容性
Vue2 | Vue3 |
---|---|
√ | √ |
App | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|
HBuilderX 4.17,Android:4.4,iOS:不支持 | × | × | × | × | × | × |
钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 |
---|---|---|---|
× | × | × | × |
H5-Safari | Android Browser | 微信浏览器(Android) | QQ浏览器(Android) | Chrome | IE | Edge | Firefox | PC-Safari |
---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × |
hl-imagepicker
图片选择
使用示例
<template>
<view>
<view class="content">
<text class="hd-btn" @click="fixPickerBtn">选择图片+视频</text>
<text class="hd-btn" @click="imageBtn">选择照片</text>
<text class="hd-btn" @click="videoBtn">选择视频</text>
<text class="hd-btn" @click="imageCapBtn">拍摄单张图片</text>
<text class="hd-btn" @click="videoCapBtn">拍摄单个视频</text>
<text class="hd-btn" @click="showImgsBtn">图片显示器</text>
</view>
<view style="padding: 0rpx 30rpx;margin-top: 30rpx;">{{dataResult}}</view>
</view>
</template>
<script>
// #ifdef UNI-APP-X
import { imageManage,ImagePickerManage, CallFunType, SelectResult } from '@/uni_modules/hl-imagepicker';
const imageLib = imageManage() as ImagePickerManage
// #endif
export default {
data() {
return {
title: 'Hello',
dataResult: ''
}
},
onLoad() {
imageLib.initImage()
},
methods: {
testFun() {
imageLib.testFun()
},
imageBtn() {
let that = this
imageLib.image({
success: function (res) {
let result = res as SelectResult
that.dataResult = JSON.stringify(result);
console.error(`result`, JSON.stringify(result))
}
} as CallFunType);
},
fixPickerBtn() {
// imageLib.fixPicker()
let that = this
imageLib.fixPicker({
success: function (res) {
let result = res as SelectResult
that.dataResult = JSON.stringify(result);
console.error(`result`, JSON.stringify(result))
}
} as CallFunType);
},
videoBtn() {
// imageLib.video()
let that = this
imageLib.video({
success: function (res) {
let result = res as SelectResult
that.dataResult = JSON.stringify(result);
console.error(`result`, JSON.stringify(result))
}
} as CallFunType);
},
imageCapBtn() {
// imageLib.imageCap()
let that = this
imageLib.imageCap({
success: function (res) {
let result = res as SelectResult
that.dataResult = JSON.stringify(result);
console.error(`result`, JSON.stringify(result))
}
} as CallFunType);
},
videoCapBtn() {
// imageLib.videoCap()
let that = this
imageLib.videoCap({
success: function (res) {
let result = res as SelectResult
that.dataResult = JSON.stringify(result);
console.error(`result`, JSON.stringify(result))
}
} as CallFunType);
},
showImgsBtn() {
// imageLib.showImgs()
let that = this
let array = [
"https://p3.dcarimg.com/img/tos-cn-i-dcdx/d7476802c2f14b54b1f016b013cd79e8~1200x0.png",
"https://p3.dcarimg.com/img/motor-mis-img/118379777d641c2c28fee64a3b076dc4~1200x0.png"
]
imageLib.showImgs(array, {
success: function (res) {
/* let result = res as SelectResult
that.dataResult = JSON.stringify(result);
console.error(`result`, JSON.stringify(result)) */
}
} as CallFunType);
}
}
}
</script>
开发文档
UTS 语法 UTS API插件 UTS 组件插件 Hello UTS