遇到很离谱的问题,新建的组件怎么获取都是null,旧组件就可以了,搞了半天,重新启动项目就可以获取了(重新编译无效、重新编译无效、重新编译无效)
selectcomponent 返回null[代码]onLoad: function(){[代码][代码] [代码][代码]this[代码][代码].barComponent = [代码][代码]this[代码][代码].selectComponent([代码][代码]'#barDom'[代码][代码]);[代码][代码] [代码][代码]console.log([代码][代码]this[代码][代码].selectComponent([代码][代码]'#barDom'[代码][代码]))[代码][代码] [代码][代码]this[代码][代码].lineComponent = [代码][代码]this[代码][代码].selectComponent([代码][代码]'#lineDom'[代码][代码]);[代码][代码] [代码][代码]this[代码][代码].pieComponent = [代码][代码]this[代码][代码].selectComponent([代码][代码]'#pieDom'[代码][代码]);[代码][代码]},[代码] [代码][代码] <ec-canvas id="lineDom" canvas-id="line" ec="{{ecLine}}"></ec-canvas> <ec-canvas id="barDom" canvas-id="bar" ec="{{ecBar}}"></ec-canvas> <ec-canvas id="pieDom" canvas-id="pie" ec="{{ecPie}}"></ec-canvas> 早上还可以取到barComponent 下午的时候就报null [图片]
05-04