diff --git a/components/tpx-bluetooth-print/create-image-data-bycanvas.vue b/components/tpx-bluetooth-print/create-image-data-bycanvas.vue index 6f545cb..657c065 100644 --- a/components/tpx-bluetooth-print/create-image-data-bycanvas.vue +++ b/components/tpx-bluetooth-print/create-image-data-bycanvas.vue @@ -1,6 +1,6 @@ @@ -14,7 +14,20 @@ export default { }, computed: { - + canvSty(){ + let sty = `width:${this.canvasWidth}px;height:${this.canvasHeight}px;` + return sty + }, + convContSty(){ + // 缩放canvas的父级,绘图可以一屏宽度显示出来 + let bodyRpxWidth = 750 + var convRpxWidth = this.canvasWidth/(uni.upx2px(100)/100); + let convRpxHeight = this.canvasHeight/(uni.upx2px(100)/100) + let scale = bodyRpxWidth * 0.92 / convRpxWidth + let sty = `transform-origin: 0 0;transform: scale(${scale});height:${convRpxHeight * scale}rpx;` + sty += `margin-left:${bodyRpxWidth * 0.08 / 2}rpx;` + return sty + } }, data () { return { @@ -87,11 +100,10 @@ export default { \ No newline at end of file diff --git a/components/tpx-bluetooth-print/tpx-bluetooth-print.vue b/components/tpx-bluetooth-print/tpx-bluetooth-print.vue index 4b40bd8..f54b705 100644 --- a/components/tpx-bluetooth-print/tpx-bluetooth-print.vue +++ b/components/tpx-bluetooth-print/tpx-bluetooth-print.vue @@ -10,13 +10,8 @@