真机测试画布getContext('2d')无法使用?
发布于 5 年前 作者 yangguiying 11032 次浏览 来自 官方Issues
wx.createSelectorQuery()
      .select('#myCanvas')
      .fields({
        node:true,
        size:true,
      })
      .exec((res) => {
        console.log(res[0])
      })

fields中读取node真机返回错误

Uncaught (in promise) ReferenceError: NativeGlobal is not defined
    at n.value ([publib]:1)
    at n.value ([publib]:1)
    at t ([publib]:1)
    at n.value ([publib]:1)
    at eval ([publib]:1)
    atnew Promise (<anonymous>)
    at t ([publib]:1)
    at eval ([publib]:1)
    at Array.forEach (<anonymous>)
    at eval ([publib]:1)

这是什么原因呢?测试机器 小米8、苹果X

2 回复

感谢反馈,目前真机调试不支持直接获取 Canvas 的 context,现在可以以预览为准。请期待后续更新。

你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部