uu
This commit is contained in:
parent
8441d5eb09
commit
5d3ac55f07
@ -6,7 +6,7 @@
|
|||||||
<template v-slot:content>
|
<template v-slot:content>
|
||||||
<view class="pt-20 pb-10">打印内容</view>
|
<view class="pt-20 pb-10">打印内容</view>
|
||||||
<view class="canvas-con">
|
<view class="canvas-con">
|
||||||
<canvas canvas-id="shareCanvas" :style="{width:canvasWidth + 'px', height: canvasHeight + 'px'}"></canvas>
|
<canvas :canvas-id="canvasId" :style="{width:canvasWidth + 'px', height: canvasHeight + 'px'}"></canvas>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</tpx-bluetooth>
|
</tpx-bluetooth>
|
||||||
@ -36,7 +36,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
canvasId: 'shareCanvas',
|
canvasId: uni.$u.guid(20),
|
||||||
canvasWidth: 1,
|
canvasWidth: 1,
|
||||||
canvasHeight: 1,
|
canvasHeight: 1,
|
||||||
imgData: '',
|
imgData: '',
|
||||||
@ -110,6 +110,9 @@ export default {
|
|||||||
console.log("===renderCanvasImg:filePath=====", filePath)
|
console.log("===renderCanvasImg:filePath=====", filePath)
|
||||||
return new Promise(async (resolve, reject)=> {
|
return new Promise(async (resolve, reject)=> {
|
||||||
try{
|
try{
|
||||||
|
// 多次渲染,createCanvasContext,必须使用新的才可以
|
||||||
|
that.canvasId = uni.$u.guid(20)
|
||||||
|
await promiseTimeout(500)
|
||||||
let res = await getImageInfo(filePath)
|
let res = await getImageInfo(filePath)
|
||||||
console.log("getImageInfo res====", res)
|
console.log("getImageInfo res====", res)
|
||||||
const ctx = uni.createCanvasContext(that.canvasId, that);
|
const ctx = uni.createCanvasContext(that.canvasId, that);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user