taro icon indicating copy to clipboard operation
taro copied to clipboard

createWebViewContext

Open zyqlovekl opened this issue 1 year ago • 2 comments

这个特性解决了什么问题?

小程序向H5通信

这个 API 长什么样?

const webViewContext = Taro.createWebViewContext('web-view-1');

const handleMessage = (e) => {
    // e.detail 是 H5 发来的消息内容
    console.log(e.detail);
    // 向H5发送消息
    webViewContext.postMessage({ 'sendToWebView': '1' });
}

zyqlovekl avatar Aug 05 '22 06:08 zyqlovekl

@zyqlovekl 这是哪里的 API ?

Chen-jj avatar Aug 09 '22 12:08 Chen-jj

同求,taro里,怎么用createWebViewContext,好像一直失效。

wenghaoping avatar Aug 30 '22 07:08 wenghaoping

@zyqlovekl 这是哪里的 API ?

应该是支付宝(钉钉)的 https://opendocs.alipay.com/mini/api/webview-context

TheKonka avatar Oct 11 '22 02:10 TheKonka