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

边栏推荐
- Schema和Model
- 微信小程序正则表达式提取链接
- Leetcode brush questions: binary tree 18 (largest binary tree)
- 实操演示:产研团队如何高效构建需求工作流?
- How to select the Block Editor? Impression notes verse, notation, flowus
- IC科普文:ECO的那些事儿
- Informatics Olympiad 1337: [example 3-2] word search tree | Luogu p5755 [noi2000] word search tree
- Leetcode skimming: binary tree 12 (all paths of binary tree)
- [C language] merge sort
- 港股将迎“最牛十元店“,名创优品能借IPO突围?
猜你喜欢

Leetcode skimming: binary tree 10 (number of nodes of a complete binary tree)

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

Hong Kong stocks will welcome the "best ten yuan store". Can famous creative products break through through the IPO?

Zero cloud new UI design

Frequent MySQL operations cause table locking problems

鸿蒙os第四次学习

CVPR 2022 | common 3D damage and data enhancement
![Scala basics [HelloWorld code parsing, variables and identifiers]](/img/75/1d89581b9b8299ffb55d95514e6df4.png)
Scala basics [HelloWorld code parsing, variables and identifiers]

Classic implementation method of Hongmeng system controlling LED

1. Strengthen learning basic knowledge points
随机推荐
【数字IC验证快速入门】8、数字IC中的典型电路及其对应的Verilog描述方法
Unity编辑器扩展 UI控件篇
sun.misc.BASE64Encoder报错解决方法[通俗易懂]
Guidelines for application of Shenzhen green and low carbon industry support plan in 2023
Leetcode(347)——前 K 个高频元素
Model method
nprogress插件 进度条
PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug
Leetcode skimming: binary tree 10 (number of nodes of a complete binary tree)
[quick start of Digital IC Verification] 6. Quick start of questasim (taking the design and verification of full adder as an example)
1、强化学习基础知识点
DP: tree DP
Is it safe for Galaxy Securities to open an account online?
【c语言】快速排序的三种实现以及优化细节
Leetcode (347) - top k high frequency elements
[Yugong series] go teaching course in July 2022 004 go code Notes
【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
Convolution free backbone network: Pyramid transformer to improve the accuracy of target detection / segmentation and other tasks (with source code)
【数字IC验证快速入门】1、浅谈数字IC验证,了解专栏内容,明确学习目标
Wechat applet regular expression extraction link