TypeError: Cannot read property 'isRoute' of undefined
-
-
@你说什么A我听不见 同问
-
@tinico cli版本和依赖的版本都升级到最新版本试试
-
@Taro-小助手-honly 不得行,我是用H5调试的
-
@Taro-小助手-honly 可以了,原因是componentDidMount执行了两次,执行第二次时会报错
componentDidMount() { if (process.env.TARO_ENV === 'h5') { if (this['__taroref_canvas']) { this.canvas = Taro.createCanvasContext('canvas', this); } } }
而且很奇怪的是明明componentDidMount已经取得了canvas了,但是componentDidShow里面使用canvas却未定义
componentDidShow() { console.log(this.canvas) // undefined }
-
@tinico this在不同作用域吧?你试试搞个全局的变量呢?