canvas接口strokeStyle is not a function?
发布于 6 年前 作者 dguo 5093 次浏览 来自 官方Issues

使用CanvasContext.strokeStyle替代废弃接口CanvasContext.setStrokeStyle时报以下错误,官方说两个接口的用法一样而且使用的代码就是官方的例子

用的CanvasContext.lineWidth CanvasContext.lineCap 一样报错

以下是代码片段

<canvas canvas-id="myCanvas"></canvas>
const ctx = wx.createCanvasContext('myCanvas')
ctx.strokeStyle('red')
ctx.strokeRect(10, 10, 150, 75)
ctx.draw()

求解答!!!!!

2 回复

ctx.strokeStyle = “red”

回到顶部