小程序云开发如何实现Ajax(wx.request)?

小程序 文章 2022-02-16 14:40 414 0 全屏看文

AI助手支持GPT4.0

小程序云开发如何实现Ajax(wx.request)?How to implement Ajax (wx.request) in applet cloud development?

小程序云开发如何实现Ajax(wx.request)?

wx.request、wx.uploadFile等网络请求API都需要配置开发者服务器接口地址,而使用云开发服务都没有这些,请问如何实现呢?

需求场景:图书馆小程序中,用户点击“更多”时显示图书信息,默认显示20个。用户每次拉到底部,再请求20个数据并显示。

wx. request、wx. UploadFile and other network request APIs need to configure the developer server interface address, which is not available when using cloud development services. How do you implement it? Demand scenario: in the library applet, when the user clicks "more", the book information is displayed, and 20 are displayed by default. Each time the user pulls to the bottom, another 20 data are requested and displayed.

回答:

Weichat:

可以使用request-promise

dreamhunter:

需求场景:图书馆小程序中,用户点击“更多”时显示图书信息,默认显示20个。用户每次拉到底部,再请求20个数据并显示。

需求云开发本身就能实现,为什么要用wx.request、wx.uploadFile?

side alley - C 0 0:请问要怎么做呢?请大佬指点思路
微喵网络:

在小程序后台配置request和upload域名

side alley - C 0 0:我全用的云开发,没有配置域名。一开始也没准备...
微喵网络:现在开始准备

-EOF-

AI助手支持GPT4.0