h5页面可以postMessage,但是小程序用@message并没有触发对应的函数?
// h5页面,在小程序会打印信息
function handleSharePageStatus() {
const data = {
url: location.href,
title: 'xxxx',
link: location.href,
desc: 'xxxx'
}
console.log('---------', data)
window.wx.miniProgram && window.wx.miniProgram.postMessage({
type: 'share',
data: data
})
}
// 小程序,在开发者工具会触发@message,但是真机验证就是不触发
<template>
<web-view :src="webUrl" @message="handleViewMessage" />
</template>