当前位置:网站首页>[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 !
边栏推荐
- [original] all management without assessment is nonsense!
- Mathematical modeling -- what is mathematical modeling
- The difference between full-time graduate students and part-time graduate students!
- Basic knowledge sorting of mongodb database
- [markdown grammar advanced] make your blog more exciting (IV: set font style and color comparison table)
- Async and await
- LeetCode3_ Longest substring without duplicate characters
- [deep learning] semantic segmentation experiment: UNET network /msrc2 dataset
- MySQL bit type resolution
- TypeScript 发布 4.8 beta 版本
猜你喜欢
HW primary flow monitoring, what should we do
Typescript release 4.8 beta
【数字IC验证快速入门】23、SystemVerilog项目实践之AHB-SRAMC(3)(AHB协议基本要点)
Steps to create P8 certificate and warehousing account
How to release NFT in batches in opensea (rinkeby test network)
OpenGL's distinction and understanding of VAO, VBO and EBO
【深度学习】语义分割实验:Unet网络/MSRC2数据集
Window环境下配置Mongodb数据库
Gd32 F3 pin mapping problem SW interface cannot be burned
Create lib Library in keil and use lib Library
随机推荐
unnamed prototyped parameters not allowed when body is present
Getting started with webgl (1)
如何在opensea批量发布NFT(Rinkeby测试网)
Unity之ASE实现全屏风沙效果
【Markdown语法高级】让你的博客更精彩(四:设置字体样式以及颜色对照表)
[quick start of Digital IC Verification] 20. Basic grammar of SystemVerilog learning 7 (coverage driven... Including practical exercises)
[server data recovery] data recovery case of raid failure of a Dell server
The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
Mathematical modeling -- what is mathematical modeling
【跟着江科大学Stm32】STM32F103C8T6_PWM控制直流电机_代码
Points for attention in porting gd32 F4 series programs to gd32 F3 series
Typescript release 4.8 beta
Database exception resolution caused by large table delete data deletion
Spin animation of Cocos performance optimization
2022 all open source enterprise card issuing network repair short website and other bugs_ 2022 enterprise level multi merchant card issuing platform source code
2. Heap sort "hard to understand sort"
Cocos uses custom material to display problems
Use of SVN
webgl_ Enter the three-dimensional world (1)
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