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

webgl预览OK,真机调试有问题。真机调试时exec()里面的回调函数没执行?

代码如下:

预览没问题,真机调试不行。真机调试时exec()里面的回调函数没执行。

预览的时候,console.log三个都能打出来。真机调试真能打出来1和2这两个。

//index.js

let canvas,selector

onReady: function () {

console.log("1---ready1")

selector = wx.createSelectorQuery()

console.log(selector.select('#webgl').node())

selector.select('#webgl').node().exec((res) => {

canvas = res[0].node

console.log("3---ready3")

})

this.ctx = wx.createCameraContext()

console.log("2---ready2")

<!-- index.wxml -->

<canvas type="webgl" id="webgl" canvas-id="webgl" style="width: 100%; height: 300px;"></canvas>

<camera device-position="back" flash="off" binderror="error" style="width: 100%; height: 300px;"></camera>


评论 抢沙发

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

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

云免签H5支付