New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
支付宝小程序,EventChannel无法监听BUG #3945
Comments
zhenyuWang
added a commit
that referenced
this issue
Oct 31, 2022
这个更新发布了吗? 影响很大 |
发布后会在该 issues 下回复 |
微信转支付宝,这个fix没发版,暂时用替代方案,你可以参考下: // 商品详情页
<script setup>
// 选择完规格、数量及配送方式,携带参数去结算页
const handleEvent = ({ product, spec, count, type }) => {
// 监听结算页加载完成
uni.$once('secondPageLoaded', data => {
// 派发事件并携带必须参数
uni.$emit('update:product', { product, spec, count, type })
})
// 跳转至结算页
uni.navigateTo({ url: '/pages/product/product-settle' })
}
</script>
// 商品结算页
<script setup>
// 监听
uni.$once('update:product', data => console.log(data) )
// 派发(须在监听事件下另起一行,否则不生效)
uni.$emit('secondPageLoaded', '页面加载完成')
// 必须先$once,再$emit,否则无法监听到(实际应该是先$emit事件,告知
// 上页“我加载完了,你派发事件给我吧”,然后再$once监听上页派发的事件,
// 接收参数。此处不知道是不是BUG)
</script> 次页向上页通信无须如此,就不贴代码了 |
HBuilderX 3.6.9 已修复 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
支付宝小程序(Vue3.x),使用页面间事件通信通道,次页面无法监听到事件
复现步骤
预期结果
点击按钮跳转至nextPage页,控制台可正常输出日志
实际结果
系统信息:
The text was updated successfully, but these errors were encountered: