画一个矩形(非填充)。
tip:用setfillstroke()设置矩形线条的颜色,如果没设置默认是黑色。
| 参数 | 类型 | 范围 | 说明 |
|---|---|---|---|
| x | number | 矩形路径左上角的x坐标 | |
| y | number | 矩形路径左上角的y坐标 | |
| width | number | 矩形路径的宽度 | |
| height | number | 矩形路径的高度 |
const ctx = wx.createcanvascontext('mycanvas')
ctx.setstrokestyle('red')
ctx.strokerect(10, 10, 150, 75)
ctx.draw()