vue的h5项目,给一元素绑定双击事件dblclick,双击事件dblclick无效不触发
解决办法:模拟双击事件
dbTest(){
// 全局声明verClickNum = 1, clickTimer = null, lastClickTime = 0;
var nowTime = new Date().getTime();
if (nowTime - this.lastClickTime < 300) {
/*双击*/
this.verClickNum++;
this.lastClickTime = 0;
this.clickTimer && clearTimeout(this.clickTimer);
} else {
/*单击*/
this.lastClickTime = nowTime;
this.clickTimer = setTimeout(function () {
if(this.verClickNum > 1){
this.verClickNum = 1;
return;
} else {
}
}, 300);
}
},