当前位置:网站首页>uni-app-双击事件模拟
uni-app-双击事件模拟
2022-07-28 05:18:00 【SheepOnTheCloud】
思路:设置一个变量数组,点击后对数组进行追加时间戳,够两个就清空,判断两次时间戳的差距是否在规定的事件呢
vue2
template中
<button @click="dblclick()">我是双击事件</button>data中
time: []methods中
dblclick(e) {
if (this.time.length < 2) {
this.time.push(new Date().getTime())
if (this.time[this.time.length - 1] - this.time[0] < 500) {//配置多晒秒内为双击
if (this.time[this.time.length - 1] - this.time[0] == 0) {
console.log('奇数点击')
} else {
console.log('0.5s内点击')
this.time = []
}
} else {
console.log('0.5s外点击')
this.time = []
}
} else {
this.time = []
}
console.log(this.time)
},总结
边栏推荐
- JVM篇 笔记3:类加载与字节码技术
- Mabtis(一)框架的基本使用
- JVM notes 3: class loading and bytecode Technology
- The Monte Carlo method solves the PI and draws points with turtle, and completes the progress bar problem
- URL form
- Oracle create table, delete table, modify table (add field, modify field, delete field) statement summary
- PyTorch 使用 MaxPool 实现图像的膨胀和腐蚀
- 蒸馏模型图
- 2021csdn blog star selection, mutual investment
- Use of IO streams
猜你喜欢
随机推荐
图像增强——MSRCR
冶金物理化学复习 --- 液 - 液相反应动力学
Openjudge: filter extra spaces
JVM note 4: Memory Model
Thesis writing function words
Shell operation principle
Mybats foreach multi select query, index loop, and cancel the and/or tag
Learning of image enhancement evaluation index -- structural similarity SSIM
ResNet结构对比
Mutual conversion between latex and word
BeanUtils. Copyproperties cannot copy different list sets problem solving lists.transform function
JVM notes 3: class loading and bytecode Technology
Openjudge: count the number of numeric characters
Mysql database index (InnoDB engine)
openjudge:字符串最大跨距
Pytorch uses maxpool to realize image expansion and corrosion
Methods of gflops and total params of pytorch calculation model
Writing methods of scientific research papers: add analysis and discussion in the method part to explain their contributions and differences
latex和word之间相互转换
Video twins: the starting point of informatization upgrading of smart Parks









