提交 ff8b2546 编写于 作者: H hdx

canvas: 调整 toDataURL 调用时机

上级 96e674fb
...@@ -94,16 +94,18 @@ ...@@ -94,16 +94,18 @@
// #ifdef WEB // #ifdef WEB
context.toBlob((blob : Blob) => { context.toBlob((blob : Blob) => {
this.testToBlobResult = (blob.size > 0 && blob.type == 'image/jpeg') this.testToBlobResult = (blob.size > 0 && blob.type == 'image/jpeg')
}, 'image/jpeg', 0.95) }, 'image/jpeg', 0.95);
this.testToDataURLResult = this.canvasContext!.toDataURL().startsWith('data:image/png;base64')
// #endif // #endif
this.testCanvasContext = true this.testCanvasContext = true
} }
}) })
}, },
onReady() { onReady() {
// TODO app-android 需要延迟调用 // TODO app-android 需要延迟调用
// #ifdef APP
this.testToDataURLResult = this.canvasContext!.toDataURL().startsWith('data:image/png;base64') this.testToDataURLResult = this.canvasContext!.toDataURL().startsWith('data:image/png;base64')
// #endif
// 同步调用方式,仅支持 app/web // 同步调用方式,仅支持 app/web
// let canvas = uni.getElementById("canvas") as UniCanvasElement // let canvas = uni.getElementById("canvas") as UniCanvasElement
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册