<web-view id="webviewId" ref="webviewRef" style="position: fixed;top: 80px;left: 0;width: 750rpx;bottom: 0;" :src="url" @message="messageHanle"></web-view>
在iOS和安卓上面都可以通过messageHanle获取H5传过来的数据,在鸿蒙next上面获取不到
sendToH5(data) {
// #ifdef APP-PLUS
const webview = this.$scope.$getAppWebview().children()[0];
webview.evalJS( // 调用 H5 的全局函数 if (window.uniappReceiveMessage) { uniappReceiveMessage(${JSON.stringify(data)}); }
);
// #endif
},
在iOS和安卓可以通过上面的方法发送数据给H5,鸿蒙next怎么发送数据给H5
0 个回复