需求:拍照,给照片加水印
<template>
<uni-icons @click="showCamera" type="camera" size="28"></uni-icons> //拍照
<view style="position: absolute;top: -999999px;"> //把canvas移出视窗
<canvas :style="{'width':w,'height': h}" canvas-id="firstCanvas"></canvas>
</view>
</template>
data:
data() {
return {
w:'',
h:'',
}
},
methods:
showCamera() {
let _self = this;
uni.chooseImage({
// sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
count: 1,
sourceType: sourceType, //相机
success: function (res) {
uni.showLoading({
title: '制作水印中...'
})