贴上代码
<canvas id="canvas" type="2d" style="background-color: blueviolet;width: {{canvasWidth}}rpx;height: {{canvasHeight}}rpx;"></canvas>
Page({
data: {
canvasWidth:750,
canvasHeight:800,
src:"https://hbimg.huabanimg.com/56a2edad23c576a631f2f1fb52939763d2f9910a37f4-wKjMvn"
},
onLoad: function (options) {
wx.createSelectorQuery().select("#canvas").fields({
node:true,
size:true,
id:true
}).exec(res=>{
let canvas=res[0].node
let ctx=canvas.getContext('2d')
let dpr=wx.getSystemInfoSync().pixelRatio
canvas.width=res[0].width*dpr
canvas.height=res[0].height*dpr
//createPattern()重复图像
imgObject.onload=()=>{
ctx.drawImage(imgObject,420,420,300,300)
const pattern = ctx.createPattern(imgObject, 'repeat')
ctx.fillStyle = pattern
ctx.fillRect(0, 0, canvas.width, canvas.height)
})
},
})
预览如图所示
开发工具里
手机上(大的猫咪是加载的一张照片,和createPattern无关)
望官方看到尽快解决
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
真机里边的createPattern不支持'no-repeat'
一样的问题,请问有解决吗