当前位置:网站首页>Applet learning path 2 - event binding
Applet learning path 2 - event binding
2022-06-30 09:10:00 【Ancient dust left Taidao】
The binding event
Bind the click event to the component
index.wxml Code
<!-- index.wxml -->
<view class="title">{
{counter}}</view>
<button bindtap="onIncreament" size="mini" type="primary">+1</button>
<button bindtap="onDecreament" size="mini" type="warn">-1</button>
Learn here , Pay attention to , In small program development , I personally think , All the labels , Should be treated as components , It can not be regarded as ordinary html label .
index.js Code
Page({
data: {
books: ['java', 'python', 'javaScript'],
counter: 0
},
onIncreament: function () {
console.log(111)
this.setData({
counter: ++this.data.counter
})
},
onDecreament () {
console.log(this)
this.setData({
counter: --this.data.counter
})
}
})
View :

summary
I found it in use ES6 Function shorthand is also feasible . Others don't pay attention
边栏推荐
- 使用华为性能管理服务,按需配置采样率
- Flink 数据偶尔数据积压导致checkpoint失败
- icon资源
- How to format an UTC date to use the Z (Zulu) zone designator in php?
- Deeply understand the working principle of kotlin collaboration suspend (beginners can also understand it)
- [shutter] solve failed assertion: line 5142 POS 12: '_ debugLocked‘: is not true.
- Occasionally, Flink data is overstocked, resulting in checkpoint failure
- Advanced technology management -- how managers design and build echelons
- Wikimedia Foundation announces the first customers of its new commercial product "Wikimedia enterprise"
- 127.0.0.1, 0.0.0.0 and localhost
猜你喜欢

Opencv learning notes -day10 logical operation of image pixels (usage of rectangle function and rect function and bit related operation in openCV)

Bind threads to run on a specific CPU logical kernel

Advanced technology management -- how managers design and build echelons

Resnet50+fpn for mmdet line by line code interpretation

使用华为性能管理服务,按需配置采样率

Qt连接神通数据库

Opencv learning notes-day5 (arithmetic operation of image pixels, add() addition function, subtract() subtraction function, divide() division function, multiply() multiplication function

QT connection to Shentong database

Wechat development tool (applet)
![[untitled]](/img/45/368c41a74bf0738369c58c5963fca0.jpg)
[untitled]
随机推荐
100 lines of code and a voice conversation assistant
Opencv learning notes-day5 (arithmetic operation of image pixels, add() addition function, subtract() subtraction function, divide() division function, multiply() multiplication function
Mmdet line by line deltaxywhbboxcoder
Is the reverse repurchase of treasury bonds absolutely safe? How to open an account online
Flink Sql -- toAppendStream doesn‘t support consuming update and delete changes which
Do you want the dialog box that pops up from the click?
Raspberry pie 4B no screen installation system and networking using VNC wireless projection function
Flink sql -- No factory implements ‘org. apache. flink. table. delegation. ExecutorFactory‘.
Flink Exception -- No ExecutorFactory found to execute the application
127.0.0.1, 0.0.0.0 and localhost
How can I get the discount for opening a securities account? Is online account opening safe?
Row column (vertical and horizontal table) conversion of SQL
Rew acoustic test (II): offline test
JVM tuning related commands and explanations
Maxiouassigner of mmdet line by line interpretation
Flink SQL 自定义 Connector
C # get the current timestamp
Agp7.0|kts makes a reinforced plug-in
证券开户的优惠怎样才能得到?在线开户安全?
Pytorch BERT