We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
字节跳动小程序
小程序基础库: 2.14.0.1 使用框架: React
navigateBack 微信和字节都能触发返回,但 onMessage 微信小程序能响应,但是字节小程序就无法响应。
web端
navigateBack = (remoteUrl) => { this.navigateBackToWechat(remoteUrl); this.navigateBackToTt(remoteUrl) } navigateBackToWechat = (remoteUrl) => { wx.miniProgram.postMessage({ data: { imgData: remoteUrl, }, }); wx.miniProgram.navigateBack(); } navigateBackToTt = (remoteUrl) => { console.log("navigateBackToTt: ", window.tt); window.tt.miniProgram.postMessage({ data: { imgData: remoteUrl, }, }); window.tt.miniProgram.navigateBack(); }
小程序端
handleMessage = async ({detail}) => { const base64Url = detail.data[0].imgData; console.log('base64Url: ', base64Url); await Taro.setStorage({ key: "tempImgUrl", data: base64Url }); } render() { const {webviewUrl} = this.state; console.log("render webviewUrl :", webviewUrl); return ( <View className="album-body-wrapper"> <WebView src={webviewUrl} onMessage={this.handleMessage}></WebView> </View> ); }
字节小程序能够像微信小程序一样,触发 onMessage 函数
无法触发 onMessage 函数
👽 Taro v3.0.8 Taro CLI 3.0.8 environment info: System: OS: macOS 11.2.3 Shell: 5.8 - /bin/zsh Binaries: Node: 15.4.0 - ~/.nvm/versions/node/v15.4.0/bin/node Yarn: 1.21.1 - ~/.yarn/bin/yarn npm: 7.0.15 - ~/.nvm/versions/node/v15.4.0/bin/npm npmPackages: @tarojs/cli: 3.2.13 => 3.2.13 @tarojs/components: 3.2.13 => 3.2.13 @tarojs/mini-runner: 3.2.13 => 3.2.13 @tarojs/react: 3.2.13 => 3.2.13 @tarojs/runtime: 3.2.13 => 3.2.13 @tarojs/taro: 3.2.13 => 3.2.13 @tarojs/webpack-runner: 3.2.13 => 3.2.13 babel-preset-taro: 3.2.13 => 3.2.13 eslint-config-taro: 3.2.13 => 3.2.13 react: ^16.10.0 => 16.14.0 taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.10
The text was updated successfully, but these errors were encountered:
No branches or pull requests
相关平台
字节跳动小程序
小程序基础库: 2.14.0.1
使用框架: React
复现步骤
navigateBack 微信和字节都能触发返回,但 onMessage 微信小程序能响应,但是字节小程序就无法响应。
web端
小程序端
期望结果
字节小程序能够像微信小程序一样,触发 onMessage 函数
实际结果
无法触发 onMessage 函数
环境信息
The text was updated successfully, but these errors were encountered: