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
微信小程序
小程序基础库: 3.2.1 使用框架: React
以下两种写法将导致onShareAppMessage分享函数失效,分享时图片和标题都是默认的并非onShareAppMessage所返回的对象。相同写法在原生的小程序是成功的。
import React, { Component } from 'react' export default class Test extends Component { onShareAppMessage() { const promise = new Promise(resolve => setTimeout(() => resolve({ title: '异步标题'}), 2000)) console.log('promise', promise) return { promise } } render() { return ( <>test</> ) } }
import React, { Component } from 'react' export default class Test extends Component { async onShareAppMessage() { const promise = await new Promise(resolve => setTimeout(() => resolve({ title: '异步标题'}), 2000)) console.log('promise', promise) return { title: promise.title, } } render() { return ( <>test</> ) } }
onShareAppMessage支持异步,分享时标题图片为onShareAppMessage返回值内容
(1)onShareAppMessage函数返回值不支持promise键值对 (2)async/await语法使得onShareAppMessage函数失效
👽 Taro v3.6.16 Taro CLI 3.6.16 environment info: System: OS: macOS 13.3.1 Shell: 5.9 - /bin/zsh Binaries: Node: 14.21.3 - ~/.nvm/versions/node/v14.21.3/bin/node npm: 6.14.18 - ~/.nvm/versions/node/v14.21.3/bin/npm npmPackages: @tarojs/cli: 3.6.19 => 3.6.19 @tarojs/components: 3.6.19 => 3.6.19 @tarojs/helper: 3.6.19 => 3.6.19 @tarojs/mini-runner: 3.6.19 => 3.6.19 @tarojs/plugin-framework-react: 3.6.19 => 3.6.19 @tarojs/plugin-platform-alipay: 3.6.19 => 3.6.19 @tarojs/plugin-platform-h5: 3.6.19 => 3.6.19 @tarojs/plugin-platform-jd: 3.6.19 => 3.6.19 @tarojs/plugin-platform-qq: 3.6.19 => 3.6.19 @tarojs/plugin-platform-swan: 3.6.19 => 3.6.19 @tarojs/plugin-platform-tt: 3.6.19 => 3.6.19 @tarojs/plugin-platform-weapp: 3.6.19 => 3.6.19 @tarojs/react: 3.6.19 => 3.6.19 @tarojs/runtime: 3.6.19 => 3.6.19 @tarojs/shared: 3.6.19 => 3.6.19 @tarojs/taro: 3.6.19 => 3.6.19 @tarojs/webpack-runner: 3.6.19 => 3.6.19 babel-preset-taro: 3.6.19 => 3.6.19 eslint-config-taro: 3.6.19 => 3.6.19 react: ^18.0.0 => 18.2.0 taro-ui: 3.1.0-beta.3 => 3.1.0-beta.3
The text was updated successfully, but these errors were encountered:
没有复现,我测试转发的标题都是 异步标题
异步标题
Sorry, something went wrong.
请问下你taro版本是多少呢。我目前版本为3.6.10
taro 最新版,不过应该跟taro 版本关系不大,我试了你说的 3.6.10 也是正常的
我重新创建了个taro项目,的确是可以。看来是代码问题。感谢回复哈
taro 最新版,不过应该跟taro 版本关系不大,我试了你说的 3.6.10 也是正常的 我重新创建了个taro项目,的确是可以。看来是代码问题。感谢回复哈
后来有找到具体啥问题不?
No branches or pull requests
相关平台
微信小程序
小程序基础库: 3.2.1
使用框架: React
复现步骤
分享函数onShareAppMessage无法使用promise对象或async/await语法
期望结果
onShareAppMessage支持异步,分享时标题图片为onShareAppMessage返回值内容
实际结果
(1)onShareAppMessage函数返回值不支持promise键值对
(2)async/await语法使得onShareAppMessage函数失效
环境信息
The text was updated successfully, but these errors were encountered: