canvasContext.strokeRect

解释:画一个矩形(非填充)。

参数:

参数名类型说明
xNumber矩形路径左上角的 x 坐标
yNumber矩形路径左上角的 y 坐标
widthNumber矩形路径的宽度
heightNumber矩形路径的高度

示例:

  1. const ctx = swan.createCanvasContext('myCanvas');
    ctx.setStrokeStyle('blue');
    ctx.strokeRect(30, 30, 150, 75);
    ctx.draw();

图片