wx.navigateTo向被打开的页面中传送数据,在ios7中获取不到吗?
发布于 6 年前 作者 kyi 12145 次浏览 来自 问答

微信WeChat: version:7.0.10

调试基础库:2.8.3

API接口:wxnavigateTo

wx.navigateTo({

url: '/pages/views/business/data/supplier/editSupplier/editSupplier',

success: function (res) {

// 通过eventChannel向被打开页面传送数据

res.eventChannel.emit('edit', {

title: '修改',

id: id,

})

}

});

被打开的页面

/**

* 生命周期函数--监听页面加载

*/

onLoad: function (options) {

let that = this;

const eventChannel = this.getOpenerEventChannel();

eventChannel.on('edit', function (data) {

console.log(data)

});

},

报错信息

this.getOpenerEventChannel is not a function;at "pages/views/business/data/supplier/editSupplier/editSupplier" page lifeCycleMethod onLoad function

TypeError: this.getOpenerEventChannel is not a function



3 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

谢邀,试试在json文件中加个"usingComponents": {} 

你可以考虑下是不是基础库的问题

回到顶部