当前位置:网站首页>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

边栏推荐
- 【愚公系列】2022年7月 Go教学课程 004-Go代码注释
- 【数字IC验证快速入门】2、通过一个SoC项目实例,了解SoC的架构,初探数字系统设计流程
- 1: Citation;
- - Oui. Net Distributed Transaction and Landing Solution
- Zero cloud new UI design
- ROS2专题【01】:win10上安装ROS2
- E. Singhal and Numbers(质因数分解)
- Oracle-表空间管理
- [Yugong series] go teaching course in July 2022 004 go code Notes
- Classic implementation method of Hongmeng system controlling LED
猜你喜欢

【数字IC验证快速入门】7、验证岗位中必备的数字电路基础知识(含常见面试题)

- Oui. Net Distributed Transaction and Landing Solution

JS implementation prohibits web page zooming (ctrl+ mouse, +, - zooming effective pro test)

Frequent MySQL operations cause table locking problems

Oracle-表空间管理

Solve the problem that the database configuration information under the ThinkPHP framework application directory is still connected by default after modification

解决php无法将string转换为json的办法

Enter the parallel world

How to form standard interface documents

2022 Beijing eye health products exhibition, eye care products exhibition, China eye Expo held in November
随机推荐
点云文件的.dat文件读取保存
Scala basics [HelloWorld code parsing, variables and identifiers]
Leetcode: binary tree 15 (find the value in the lower left corner of the tree)
Rainbond 5.7.1 支持对接多家公有云和集群异常报警
.Net分布式事务及落地解决方案
Relationship between mongodb documents
[quick start of Digital IC Verification] 3. Introduction to the whole process of Digital IC Design
- Oui. Net Distributed Transaction and Landing Solution
ROS2专题【01】:win10上安装ROS2
c語言oj得pe,ACM入門之OJ~
欢迎来战,赢取丰厚奖金:Code Golf 代码高尔夫挑战赛正式启动
解决Thinkphp框架应用目录下数据库配置信息修改后依然按默认方式连接
B站UP搭建世界首个纯红石神经网络、基于深度学习动作识别的色情检测、陈天奇《机器学编译MLC》课程进展、AI前沿论文 | ShowMeAI资讯日报 #07.05
Dry goods navigation in this quarter | Q2 2022
July 4, 2022 - July 10, 2022 (UE4 video tutorial MySQL)
C langue OJ obtenir PE, ACM démarrer OJ
CCPC 2021 Weihai - G. shinyruo and KFC (combination number, tips)
USACO3.4 “破锣摇滚”乐队 Raucous Rockers - DP
【愚公系列】2022年7月 Go教学课程 004-Go代码注释
Process file and directory names