html52.com
我爱小程序-开发者交流社区

绘图方法不能找到fillstyle?

const query = wx.createSelectorQuery()

query.select('#myCanvas')

.fields({ node: true, size: true })

.exec((res) => {

const canvas = res[0].node

const ctx = canvas.getContext('2d')


const dpr = wx.getSystemInfoSync().pixelRatio

canvas.width = res[0].width * dpr

canvas.height = res[0].height * dpr

// context.scale(dpr, dpr)


// context.fillRect(0, 0, 100, 100)

ctx.arc(100, 75, 50, 0, 2 * Math.PI)

ctx.fillStyle("#EEEEEE")

这个代码 fillStyle 直接报错了。 提示未找到函数

网友回复

林子:

fillStyle 是属性把,不是方法

ctx.fillStyle = "#EEEEEE" 你试一下

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付