- .node获取不到节点信息,官方提供的示例有问题?
我是在页面中操作的 <!--pages/iospage/user/user.wxml--> <view> <view class="canvas">hemlo </view> </view> // pages/iospage/user/user.js Page({ onReady() { wx.createSelectorQuery().select('.canvas').node(function(res){ console.log(res.node) // 节点对应的 Canvas 实例。 //undefined ????? }).exec() }, })
2022-07-05 - lottie-miniprogram一直报错“nodeId undefined”怎么处理?
Cannot read property \'nodeId\' of undefined TypeError: Cannot read property \'nodeId\' of undefined at Image.set [as src] (https://lib/WASubContext.js:2:667557) at mp.set src [as src] (https://lib/WASubContext.js:2:739954) at Object.r [as _createImageData] (https://miniprogram_npm/lottie-miniprogram/index.js:9:53749) at Object.i [as loadAssets] (https://miniprogram_npm/lottie-miniprogram/index.js:9:53918) at AnimationItem.preloadImages (https://miniprogram_npm/lottie-miniprogram/index.js:9:143984) at AnimationItem.configAnimation (https://miniprogram_npm/lottie-miniprogram/index.js:9:144519) .............. 报错内容如上,这个是只有安卓机报错,比较多,还有一种是下面的,只有ios报错。 undefined is not an object (evaluating \'t.nodeId\') set@https://lib/WASubContext.js:2:667556 src@https://lib/WASubContext.js:2:739950 r@https://usr//app-service.js:9290:72032 i@https://usr//app-service.js:9290:72218 ....... 查看错误定位到 lottie-miniprogram/index.js的如图位置 [图片] 使用代码如下,是完全按文档写。 wx.createSelectorQuery().in(this).selectAll('#welfare_lottie').node(res => { const canvas = res[0].node const context = canvas.getContext('2d') canvas.width = 144 canvas.height = 144 lottie.setup(canvas) this.ani = lottie.loadAnimation({ loop: true, autoplay: true, path: 'https://img.picka.com.cn/mini-program/json/lottie.json', rendererSettings: { context, }, }) this.inited = true }).exec()
2021-09-24