当前位置:网站首页>Applet event binding
Applet event binding
2022-07-05 20:26:00 【'wx】
1. What is an event
Events are the means of communication from the rendering layer to the logical layer . Through events, the user's behavior in the render layer can be , Feed back to the logic layer for business processing
2. Applet common events
type | Binding method | Description of the incident |
tap | bindtap or bind:tap | Leave as soon as you touch your fingers , Be similar to HTML Medium click event |
input | bindinput or bind:input | The input event of the text box |
change | bindchange or bind:change | Triggered when the state changes |
3. Property list of the event object
When the event callback is triggered , Will receive an event object event, Its detailed properties are as follows
attribute | type | explain |
type | String | Event type |
timeStamp | Integer | The number of milliseconds it took for the page to open to trigger the event |
target | Object | A collection of property values for the component that triggered the event |
currentTarget | Object | Some property value collections of the current component |
detail | Object | Additional information |
touches | Array | Touch event , An array of touch point information currently on the screen |
changedTouches | Array | Touch event , Array of currently changing touchpoint information |
4.target and currentTarget The difference between
target Is the source component that triggered the event , and currentTarget Is the component bound by the current event
5.bindtap Grammar format
adopt bindtap Bind for component tap Touch event
<button bindtap="btnGet"> launch get request </button>
On page .js Define the corresponding event handling function in the file , The time parameter passes through the formal parameter event( Generally abbreviated as e) To accept :
btnGet() {
wx.request({
url: 'https://applet-base-api-t.itheima.net/api/get',
method: 'GET',
data: {
name: 'xiaoming',
age: 12
},
success: (res) => {
console.log(res.data)
}
})
},
6. In the event handler function is data Data assignment in
this.setData({
canIUseGetUserProfile: true
})
7. Event biography
Provided by components data-* Custom attribute transfer parameter ,* Represents the name of the parameter
边栏推荐
- Leetcode brush question: binary tree 14 (sum of left leaves)
- 1: Citation;
- Leetcode brush questions: binary tree 18 (largest binary tree)
- Sort and projection
- 【数字IC验证快速入门】1、浅谈数字IC验证,了解专栏内容,明确学习目标
- 中金财富在网上开户安全吗?
- CTF逆向基础
- 【数字IC验证快速入门】6、Questasim 快速上手使用(以全加器设计与验证为例)
- CVPR 2022 | common 3D damage and data enhancement
- How to choose a good external disk platform, safe and formal?
猜你喜欢
[quick start of Digital IC Verification] 9. Finite state machine (FSM) necessary for Verilog RTL design
A solution to PHP's inability to convert strings into JSON
鸿蒙系统控制LED的实现方法之经典
Oracle-表空间管理
Hong Kong stocks will welcome the "best ten yuan store". Can famous creative products break through through the IPO?
Zero cloud new UI design
1. Strengthen learning basic knowledge points
CTF逆向基础
【数字IC验证快速入门】3、数字IC设计全流程介绍
Leetcode brush question: binary tree 13 (the same tree)
随机推荐
Sort and projection
CTF逆向基础
解决Thinkphp框架应用目录下数据库配置信息修改后依然按默认方式连接
.Net分布式事務及落地解决方案
Process file and directory names
. Net distributed transaction and landing solution
Leetcode (347) - top k high frequency elements
Is it safe for Galaxy Securities to open an account online?
解决php无法将string转换为json的办法
PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
Go language learning tutorial (XV)
【数字IC验证快速入门】7、验证岗位中必备的数字电路基础知识(含常见面试题)
Leetcode skimming: binary tree 12 (all paths of binary tree)
【数字IC验证快速入门】8、数字IC中的典型电路及其对应的Verilog描述方法
[quick start of Digital IC Verification] 6. Quick start of questasim (taking the design and verification of full adder as an example)
Leetcode skimming: binary tree 10 (number of nodes of a complete binary tree)
mongodb基操的练习
【数字IC验证快速入门】6、Questasim 快速上手使用(以全加器设计与验证为例)
Leetcode: binary tree 15 (find the value in the lower left corner of the tree)
物联网智能家居基本方法实现之经典