小程序canvas绘制纯色圆角区域 setdata数组某一项

小程序canvas绘制纯色圆角区域:

//方法:
roundRectPath:function(ctx, x, y, w, h, r) {
  ctx.beginPath();
  ctx.moveTo(x + r, y);
  ctx.arcTo(x + w, y, x + w, y + h, r);
  ctx.arcTo(x + w, y + h, x, y + h, r);
  ctx.arcTo(x, y + h, x, y, r);
  ctx.arcTo(x, y, x + w, y, r);
  ctx.closePath();
},

//使用:
ctx.setFillStyle('#fff')
_this.roundRectPath(ctx,10, 370, 280, 80,10);
ctx.fill()

setdata数组某一项:

this.setData({
     ["IndexN[7]"]:3
 })
posted @ 2020-10-29 17:52  夏目的三三  阅读(158)  评论(0编辑  收藏  举报