officialAccount/compontent/public/camera.vue

37 lines
980 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<!-- https://ext.dcloud.net.cn/plugin?id=10333文档在这里自己看 -->
<qf-image-cropper :src="src" :width="width" :height="height" :radius="0" @crop="handleCrop" />
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app';
import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue'
// 图片源
const src = ref('') // 可以根据需要动态设置图片路径
const type = ref(0);
const width = ref(900);
const height = ref(600);
// 裁剪完成的回调
const handleCrop = (e) => {
// console.log("剪切完了")
uni.setStorageSync(`imgkey${type.value}`, e.tempFilePath);
uni.navigateBack()
}
onLoad((options) => {
src.value = options.url
//type是一个页面有两个照相的时候做个类型区分
type.value = options.type
if(options.size){
width.value = 1500;
height.value = 1000;
}
});
</script>