feat:拍完后uni.compressImage缩放至1080×1080

This commit is contained in:
ShenQiLun 2026-06-26 09:59:06 +08:00
parent 95a112c401
commit 22d23797c5

View File

@ -130,8 +130,30 @@
path = e.detail.path || '' path = e.detail.path || ''
} }
if (path) { if (path) {
// takePhotoSnapshot截取预览区域=所见即所得,直接使用 this.resizeAndAdd(path)
this.capturedList.push(path) }
},
// 等比例放大到 1080×1080
resizeAndAdd(srcPath) {
var that = this
try {
uni.compressImage({
src: srcPath,
width: 1080,
height: 1080,
quality: 95,
success: function(res) {
that.capturedList.push(res.tempFilePath)
that.$forceUpdate()
},
fail: function() {
that.capturedList.push(srcPath)
that.$forceUpdate()
}
})
} catch(e) {
this.capturedList.push(srcPath)
this.$forceUpdate()
} }
}, },
flipCamera() { flipCamera() {