提交 9dc28abb 编写于 作者: Q qiang

fix: 修复 app-v3 uni.canvasToTempFilePath fileType 参数不生效的问题

上级 549d450b
......@@ -63,9 +63,10 @@ export const canvasPutImageData = {
}
}
const fileType = {
const fileTypes = {
PNG: 'png',
JPG: 'jpeg'
JPG: 'jpg',
JPEG: 'jpg'
}
export const canvasToTempFilePath = {
......@@ -103,7 +104,7 @@ export const canvasToTempFilePath = {
type: String,
validator (value, params) {
value = (value || '').toUpperCase()
params.fileType = value in fileType ? fileType[value] : fileType.PNG
params.fileType = value in fileTypes ? fileTypes[value] : fileTypes.PNG
}
},
quality: {
......
......@@ -549,7 +549,8 @@ export default {
const img = new Image()
img.onload = () => {
const canvas = getTempCanvas(destWidth, destHeight)
if (fileType === 'jpeg') {
if (fileType === 'jpeg' || fileType === 'jpg') {
fileType = 'jpeg'
c2d.fillStyle = '#fff'
c2d.fillRect(0, 0, destWidth, destHeight)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册