当前位置:网站首页>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
边栏推荐
- Is the reverse repurchase of treasury bonds absolutely safe? How to open an account online
- CUDA realizes matrix multiplication
- Summary of common pytoch APIs
- Opencv learning notes -day10 logical operation of image pixels (usage of rectangle function and rect function and bit related operation in openCV)
- Esp32 things (V): analysis of common API of esp32 of Swiss Army knife
- Understanding of MVVM and MVC
- Wechat development tool (applet)
- 技术管理进阶——管理者如何进行梯队设计及建设
- Anchorgenerator for mmdet line by line interpretation
- Flink sql -- No factory implements ‘org. apache. flink. table. delegation. ExecutorFactory‘.
猜你喜欢

Abstract factory pattern

Talk about the kotlin cooperation process and the difference between job and supervisorjob

Pit encountered by fastjason

Flink Sql -- toAppendStream doesn‘t support consuming update and delete changes which

基于Svelte3.x桌面端UI组件库Svelte UI

What kind of experience is it to develop a "grandson" who will call himself "Grandpa"?

Esp32 things (II): sharpening the knife without mistaking firewood - make preparations before project development

将线程绑定在某个具体的CPU逻辑内核上运行
![[data analysis and display]](/img/86/19260ee664769c98588d8b0783ef28.jpg)
[data analysis and display]

Opencv learning notes-day5 (arithmetic operation of image pixels, add() addition function, subtract() subtraction function, divide() division function, multiply() multiplication function
随机推荐
Opencv learning notes -day8 (keyboard typing (waitkey()); Wait for typing) action: triggers some action when the appropriate character is typed using the keyboard)
Use of Baidu face recognition API
Design specification for smart speakers v1.0
Treatment process record of Union Medical College Hospital (Dongdan hospital area)
Esp32 (IX): OTA function of function development
Mmcv expanding CUDA operator beginner level chapter
Qt连接神通数据库
Coredata acquisition in swift sorting, ascending, descending
Esp32 things (VIII): music playing function of function development
Alcohol tester scheme: what principle does the alcohol tester measure alcohol solubility based on?
[untitled]
Flink sql -- No factory implements ‘org. apache. flink. table. delegation. ExecutorFactory‘.
Rew acoustic test (II): offline test
Rew acoustic test (V): equipment required for test
Rew acoustic test (IV): test principle of rew
Wikimedia Foundation announces the first customers of its new commercial product "Wikimedia enterprise"
[paid promotion] collection of frequently asked questions, FAQ of recommended list
Do you want the dialog box that pops up from the click?
RPC understanding
Opencv learning notes -day 11 (split() channel separation function and merge() channel merge function)