当前位置:网站首页>[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 !
边栏推荐
- What are the safest securities trading apps
- Use of SVN
- [quick start of Digital IC Verification] 19. Basic grammar of SystemVerilog learning 6 (thread internal communication... Including practical exercises)
- Super signature principle (fully automated super signature) [Yun Xiaoduo]
- Unity之ASE实现全屏风沙效果
- 2. Basic knowledge of golang
- Monthly observation of internet medical field in May 2022
- 最安全的证券交易app都有哪些
- jacoco代码覆盖率
- [Data Mining] Visual Pattern Mining: Hog Feature + cosinus Similarity / K - means Clustering
猜你喜欢

How to release NFT in batches in opensea (rinkeby test network)

有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?

webgl_ Enter the three-dimensional world (2)
![[Data Mining] Visual Pattern Mining: Hog Feature + cosinus Similarity / K - means Clustering](/img/a4/7320f5d266308f6003cc27964e49f3.png)
[Data Mining] Visual Pattern Mining: Hog Feature + cosinus Similarity / K - means Clustering
![[quick start of Digital IC Verification] 24. AHB sramc of SystemVerilog project practice (4) (AHB continues to deepen)](/img/cf/45775b712f60869186a25d3657ee1b.png)
[quick start of Digital IC Verification] 24. AHB sramc of SystemVerilog project practice (4) (AHB continues to deepen)

【数字IC验证快速入门】20、SystemVerilog学习之基本语法7(覆盖率驱动...内含实践练习)

2. 堆排序『较难理解的排序』

居然从408改考自命题!211华北电力大学(北京)

unnamed prototyped parameters not allowed when body is present
![[data mining] visual pattern mining: hog feature + cosine similarity /k-means clustering](/img/a4/7320f5d266308f6003cc27964e49f3.png)
[data mining] visual pattern mining: hog feature + cosine similarity /k-means clustering
随机推荐
[quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)
webgl_ Enter the three-dimensional world (1)
【目标检测】YOLOv5跑通VOC2007数据集
Steps to create P8 certificate and warehousing account
【兰州大学】考研初试复试资料分享
【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
2. Basic knowledge of golang
What are PV and UV? pv、uv
全日制研究生和非全日制研究生的区别!
[deep learning] semantic segmentation experiment: UNET network /msrc2 dataset
有钱人买房就是不一样
LeetCode1_ Sum of two numbers
2. Heap sort "hard to understand sort"
简述keepalived工作原理
【数字IC验证快速入门】23、SystemVerilog项目实践之AHB-SRAMC(3)(AHB协议基本要点)
避坑:Sql中 in 和not in中有null值的情况说明
Connecting FTP server tutorial
MongoDB数据库基础知识整理
【數字IC驗證快速入門】26、SystemVerilog項目實踐之AHB-SRAMC(6)(APB協議基本要點)
MongoD管理数据库的方法介绍