当前位置:网站首页>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)
},总结
边栏推荐
- Openjudge: find all substring positions
- ByteBuffer. Position throws exception illegalargumentexception
- Simpledateformat thread unsafe and datetimeformatter thread safe
- Idea configures the service (run dashboard) service, and multiple modules are started at the same time
- 标准C语言学习总结9
- Use of IO streams
- 顺序表oj之合并两个有序数组
- Solve the problem that Oracle cannot use more than 1000 in statements
- When SQL queries the list, the data is inconsistent twice, and limit is automatically added
- Mybats foreach multi select query, index loop, and cancel the and/or tag
猜你喜欢

Advanced multi threading: the underlying principle of synchronized, the process of lock optimization and lock upgrade

Custom JSON return data

蒸馏模型图

How to compare long and integer and why to report errors

树莓派WIFI一键连接配置

JUC notes

Thesis writing function words

visio如何快速生成相同的图案,生成图像矩阵

科研论文写作方法:在方法部分添加分析和讨论说明自己的贡献和不同

Invalid bound statement (not found): com.exam.mapper.UserMapper.findbyid
随机推荐
Oracle uses SQL to query the field information of a table (field type, length, etc.)
Pytorch uses maxpool to realize image expansion and corrosion
Mybats foreach multi select query, index loop, and cancel the and/or tag
Invalid bound statement (not found): com.exam.mapper.UserMapper.findbyid
低照度图像数据集
动态卷积的本质
冶金物理化学复习 --- 气-液相反应动力学
Mabtis (I) basic use of framework
JVM篇 笔记3:类加载与字节码技术
Solve the problem that Oracle cannot use more than 1000 in statements
冶金物理化学复习 --- 冶金反应动力学基础与多相反应动力学特征
Thesis writing function words
Response < t > class
ByteBuffer. Position throws exception illegalargumentexception
Idea configures the service (run dashboard) service, and multiple modules are started at the same time
(dark horse) MySQL beginner advanced notes (blogger lazy dog)
Feignclient calls the get method and reports an error resultvo{result= unknown exception. Exception details: request method 'post' not supported
论文写作用词
SSM project quick build project configuration file
openjudge:万年历