Skip to content
New issue

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

Taro.request返回对象问题 #14851

Closed
chendiedie opened this issue Nov 20, 2023 · 1 comment
Closed

Taro.request返回对象问题 #14851

chendiedie opened this issue Nov 20, 2023 · 1 comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@chendiedie
Copy link

相关平台

微信小程序

小程序基础库: 2.33.0
使用框架: React

复现步骤

<T = any, U = any>(option: Option<T, U>) => RequestTask

以上是文档中定义的request方法,返回一个RequestTask对象,但实际返回的是一个promise,微信小程序原生wx.request方法返回的RequestTask对象不一致,因此Taro.request的返回值无法使用RequestTask的api

基础库版本:2.33.0
"@tarojs/cli": "3.4.6",
"@tarojs/components": "3.4.6",
"@tarojs/react": "3.4.6",
"@tarojs/runtime": "3.4.6",
"@tarojs/taro": "3.4.6",

期望结果

返回RequestTask对象

实际结果

返回的是Promise对象

环境信息

 Taro CLI 3.4.6 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 16.17.0 - C:\Users\wooduan\AppData\Local\Volta\tools\image\node\16.17.0\node.EXE    
      Yarn: 1.22.19 - C:\Users\wooduan\AppData\Local\Volta\tools\image\yarn\1.22.19\bin\yarn.CMD
      npm: 8.19.1 - C:\Users\wooduan\AppData\Local\Volta\tools\image\npm\8.19.1\bin\npm.CMD

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Nov 20, 2023
@TheKonka
Copy link
Member

TheKonka commented Mar 2, 2024

可以使用吧, taro 只是封装了一下,RequestTask的api 都可以用的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Archived in project
Development

No branches or pull requests

3 participants