|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<view class="container">
|
|
|
- <canvas :style="{ width: '750rpx', height: '1624rpx',}" canvas-id="myCanvas" id="myCanvas" class="hb"></canvas>
|
|
|
+ <canvas :style="{ width: canvasW + 'px', height: canvasH + 'px',}" canvas-id="myCanvas" id="myCanvas" class="hb"></canvas>
|
|
|
<!-- #ifndef MP -->
|
|
|
<div class="preserve">
|
|
|
<div class="line"></div>
|
|
@@ -47,6 +47,8 @@
|
|
|
// #endif
|
|
|
data() {
|
|
|
return {
|
|
|
+ canvasW: '',
|
|
|
+ canvasH: '',
|
|
|
bgimg: '',
|
|
|
qrimg: '',
|
|
|
shareList: [],
|
|
@@ -224,10 +226,11 @@
|
|
|
// 获取商品主图,二维码信息,APP端会返回图片的本地路径(H5端只能返回原路径)
|
|
|
this.goodsImg = await this.getImageInfo(that.bgimg);
|
|
|
this.ewmImg = await this.getImageInfo(that.qrcode);
|
|
|
- // this.canvasW = this.SystemInfo.windowWidth; // 画布宽度
|
|
|
+ this.canvasW = this.SystemInfo.windowWidth; // 画布宽度
|
|
|
this.ratio = this.SystemInfo.windowWidth / 750;
|
|
|
- this.canvasW =750 * this.ratio;
|
|
|
- this.canvasH = 1624 * this.ratio;
|
|
|
+ let x = 750*this.goodsImg.height/this.goodsImg.width
|
|
|
+ // this.canvasW =750 * this.ratio;
|
|
|
+ this.canvasH = x * this.ratio;
|
|
|
|
|
|
this.ewmW = 220 * this.ratio;
|
|
|
|