当前位置:网站首页>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(695)——岛屿的最大面积
- Notes on key vocabulary in the English original of the biography of jobs (12) [chapter ten & eleven]
- sun.misc.BASE64Encoder报错解决方法[通俗易懂]
- 【c语言】快速排序的三种实现以及优化细节
- 【数字IC验证快速入门】7、验证岗位中必备的数字电路基础知识(含常见面试题)
- E. Singhal and Numbers(质因数分解)
- Informatics Orsay all in one 1339: [example 3-4] find the post order traversal | Valley p1827 [usaco3.4] American Heritage
- Leetcode skimming: binary tree 16 (path sum)
- Mongodb basic exercises
- Codeforces Round #804 (Div. 2) - A, B, C
猜你喜欢
Leetcode (695) - the largest area of an island
港股将迎“最牛十元店“,名创优品能借IPO突围?
【刷题记录】1. 两数之和
计算lnx的一种方式
鸿蒙系统控制LED的实现方法之经典
Ros2 topic [01]: installing ros2 on win10
Leetcode: binary tree 15 (find the value in the lower left corner of the tree)
1、强化学习基础知识点
Leetcode(695)——岛屿的最大面积
Classic implementation of the basic method of intelligent home of Internet of things
随机推荐
[quick start of Digital IC Verification] 9. Finite state machine (FSM) necessary for Verilog RTL design
Is it safe for Galaxy Securities to open an account online?
19 mongoose modularization
National Eye Care Education Conference, 2022 the Fourth Beijing International Youth eye health industry exhibition
物联网智能家居基本方法实现之经典
Leetcode (347) - top k high frequency elements
sun. misc. Base64encoder error reporting solution [easy to understand]
炒股开户最低佣金,低佣金开户去哪里手机上开户安全吗
Codeforces Round #804 (Div. 2) - A, B, C
19 Mongoose模块化
About the priority of Bram IP reset
USACO3.4 “破锣摇滚”乐队 Raucous Rockers - DP
ICTCLAS word Lucene 4.9 binding
【数字IC验证快速入门】9、Verilog RTL设计必会的有限状态机(FSM)
解决Thinkphp框架应用目录下数据库配置信息修改后依然按默认方式连接
【c语言】快速排序的三种实现以及优化细节
y57.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(三十)
Model method
资源道具化
How to select the Block Editor? Impression notes verse, notation, flowus