当前位置:网站首页>[wechat applet] Chapter (5): basic API interface of wechat applet
[wechat applet] Chapter (5): basic API interface of wechat applet
2022-07-07 15:46:00 【wangzirui32】
Bowen author wangzirui32
Like can give the thumbs-up Collection Pay attention to ~~
This article was first published in CSDN, Reprint is prohibited without permissionhello, Hello everyone , I am a wangzirui32, Today, let's learn the basics of wechat applet API Interface , Start learning !
Catalog
1. wx.request
function : Request data from the server , Only initiation is supported HTTPS Network request .
Parameters :
Example :
wx.request({
url: 'https://114.51.4.191',
data: {
"a": "abc"
},
})
2. wx.downloadFile
function : Download files on the network .
attribute :
Callback function parameters after successful request :
Example :
wx.downloadFile({
url: 'https://11.45.14.19/files/19810', // Example resource address
success (res) {
if (res.statusCode === 200) {
alert("OK");
};
}})
3.wx.uploadFile()
function : Upload the file to the designated url.
attribute 
Call successfully callback parameters :
Example :
wx.uploadFile({
url: 'https://11.45.14.19/upload',
filePath: "example_filepath",
name: 'file',
formData: {
'date': '2022-7-5'
},
success (res){
var data = res.data;
}
})
4. wx.switchTab
function : Jump to TabBar page .
attribute :
Example :
wx.switchTab({
url: '/example_1'
})
5. wx.reLaunch
function : Close all pages , Open to a page in the app .
attribute :
Example :
wx.reLaunch({
url: '/example_2'
})
6. wx.redirectTo
function : Jump to a page .
attribute :
Example :
wx.redirectTo({
url: '/example_3'
})
7. wx.navigateTo
function : Keep the current page , Jump to a page in the app .
attribute :
Example :
wx.navigateTo({
url: '/example_4'
})
8. wx.navigateBack
function : Close current page , Go back to the previous page .
attribute :
Example :
wx.navigateBack({
url: '/example_5'
})
9. EventChannel
9.1 EventChannel.emit
function : Trigger an event .
structure :
EventChannel.emit( Event name )
9.2 EventChannel.off
function : Cancel listening for an event .
structure :
EventChannel.off( Event name , Callback function )
9.3 EventChannel.on
function : Keep listening for an event .
structure :
EventChannel.on( Event name , Callback function )
9.4 EventChannel.once
function : Listen to an event once , Failure after triggering .
structure :
EventChannel.once( Event name , Callback function )
10. wx.canIUse
function : Judge the... Of the applet API, Callback , Parameters , Is the component available in the current version .
Return value : Boolean value (True perhaps False).
structure :
wx.canIUse(schema)
// schema Parameter format ( Yes 2 Kind of )
// 1. ${API}.${method}.${param}.${option}
// 2. ${component}.${attribute}.${option}
Okay , That's all for today's lesson , I am a wangzirui32, You can collect and pay attention to what you like , See you next time !
边栏推荐
- 最安全的证券交易app都有哪些
- 【OBS】RTMPSockBuf_ Fill, remote host closed connection.
- 写一篇万字长文《CAS自旋锁》送杰伦的新专辑登顶热榜
- [server data recovery] data recovery case of raid failure of a Dell server
- [deep learning] image hyperspectral experiment: srcnn/fsrcnn
- 避坑:Sql中 in 和not in中有null值的情况说明
- [quick start of Digital IC Verification] 26. Ahb-sramc of SystemVerilog project practice (6) (basic points of APB protocol)
- Typescript release 4.8 beta
- OpenGL common functions
- [target detection] yolov5 Runtong voc2007 data set
猜你喜欢

Keil5 does not support online simulation of STM32 F0 series

Unity之ASE实现全屏风沙效果

There is a cow, which gives birth to a heifer at the beginning of each year. Each heifer has a heifer at the beginning of each year since the fourth year. Please program how many cows are there in the
![[quick start of Digital IC Verification] 18. Basic grammar of SystemVerilog learning 5 (concurrent threads... Including practical exercises)](/img/91/16a370ac41adc8fe31507765a82b0a.png)
[quick start of Digital IC Verification] 18. Basic grammar of SystemVerilog learning 5 (concurrent threads... Including practical exercises)

2022全开源企业发卡网修复短网址等BUG_2022企业级多商户发卡平台源码

Use cpolar to build a business website (2)
![[quickstart to Digital IC Validation] 20. Basic syntax for system verilog Learning 7 (Coverage Driven... Including practical exercises)](/img/d3/cab8a1cba3c8d8107ce4a95f328d36.png)
[quickstart to Digital IC Validation] 20. Basic syntax for system verilog Learning 7 (Coverage Driven... Including practical exercises)

Unity之ASE实现卡通火焰

Cocos creator collision and collision callback do not take effect

Steps to create P8 certificate and warehousing account
随机推荐
Spin animation of Cocos performance optimization
MySQL bit类型解析
What is Base64?
MySQL bit type resolution
The download button and debug button in keil are grayed out
Pat grade a 1103 integer factorizatio
[quick start of Digital IC Verification] 25. AHB sramc of SystemVerilog project practice (5) (AHB key review, key points refining)
【数据挖掘】视觉模式挖掘:Hog特征+余弦相似度/k-means聚类
There is a cow, which gives birth to a heifer at the beginning of each year. Each heifer has a heifer at the beginning of each year since the fourth year. Please program how many cows are there in the
Share the technical details of super signature system construction
[quick start for Digital IC Validation] 26. Ahb - sramc (6) for system verilog project practice (Basic Points of APB Protocol)
Excerpted words
The bank needs to build the middle office capability of the intelligent customer service module to drive the upgrade of the whole scene intelligent customer service
LeetCode2_ Add two numbers
Jacobo code coverage
Monthly observation of internet medical field in May 2022
【搞船日记】【Shapr3D的STL格式转Gcode】
【深度学习】图像超分实验:SRCNN/FSRCNN
Gd32 F3 pin mapping problem SW interface cannot be burned
Webgl texture