问题现象:
has.navigateTo接口拉起新页面时,两个页面无法通过EventChannel进行页面通信。报错信息主要为:
报错信息1:[console]: disposePageLifetime -> trigger page lifetime error, lifetime: onLoad, message: this.eventChannel.on is not a function
报错信息2:[console]: JSVM error stack: TypeError: this.eventChannel.emit is not a function
可能原因:
项目设置最低运行时版本为2.0.0及以上版本时,被拉起页面在onLoad阶段EventChannel实例尚未完成初始化,此时调用其on、emit等方法会报"is not a function"错误。
解决措施:
将EventChannel的初始化和使用从onLoad回调移至onReady回调中,确保EventChannel实例就绪后再调用。
修复说明:
该问题已在ASCF运行时2.0.4版本修复。