亲,,怎么获取的呢,,也是获取不到
canvas 获取失败?[代码]export [代码][代码]default[代码] [代码]class ProgressPanel extends Component {[代码][代码] [代码] [代码] [代码][代码]componentDidMount () {[代码][代码] [代码][代码]console.log([代码][代码]'test componentDidMount'[代码][代码])[代码][代码] [代码][代码]const query = wx.createSelectorQuery().[代码][代码]in[代码][代码]([代码][代码]this[代码][代码])[代码][代码] [代码][代码]query.select([代码][代码]'#myCanvas'[代码][代码])[代码][代码] [代码][代码].fields({ node: [代码][代码]true[代码][代码], size: [代码][代码]true[代码] [代码]})[代码][代码] [代码][代码].exec((res) => {[代码][代码] [代码][代码]console.log([代码][代码]'test ProgressPanel res 没执行到这里'[代码][代码], 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[代码][代码] [代码][代码]ctx.scale(dpr, dpr)[代码][代码] [代码] [代码] [代码][代码]ctx.fillRect(0, 0, 100, 100)[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]public render() {[代码][代码] [代码][代码]return[代码] [代码]([代码][代码] [代码][代码]<View className=[代码][代码]"panel"[代码][代码]>[代码][代码] [代码][代码]<View className=[代码][代码]"panel-background"[代码][代码]>[代码][代码] [代码][代码]<View id=[代码][代码]"canvas_container"[代码] [代码]className=[代码][代码]"panel-background-gray"[代码][代码]>[代码][代码] [代码][代码]<canvas style=[代码][代码]'width: 300px; height: 200px;'[代码] [代码]canvas-id=[代码][代码]'myCanvas'[代码] [代码]/>[代码][代码] [代码][代码]</View>[代码] [代码] [代码][代码]</View>[代码] [代码] [代码][代码]</View>[代码][代码] [代码][代码])[代码] [代码] [代码][代码]}[代码][代码] [代码] [代码]}[代码] 获取失败 没有拿到canvas
2020-05-10解决没,,遇到同样问题,,看到望回复谢谢
video组件中src引用地址后,无法播放视频,总显示 caught (in promise)在video组件中src引用地址后,无法播放视频,总显示 uncaught (in promise) console.error @ VM89:1 (anonymous) @ VM119:2 而且后期我是复制老师的源代码,终于可以播放了,但是再次打开后又变成那样了
2020-04-29