const nodeCount = ref(0);
const preNodeId = ref();
const curNodeId = ref();
const nodeTimer = ref();
const doubleClick = async (data: any) => {
nodeCount.value++;
console.log("1 nodeCount", nodeCount.value);
if (preNodeId.value && nodeCount.value >= 2) {
//双击事件:第一次点击的结点与第二次相同
curNodeId.value = data.NodeID;
nodeCount.value = 0;
if (data.BindReviewTableValue < 0) {
return;
}
console.log("2 curNodeId", curNodeId.value);
if (curNodeId.value == preNodeId.value) {
console.log("double click exection");
//判断是否有权限新建:
if (!checkPermission(data.NodeCode)) {
warnMessage("无相应新建权限!");
return;
}
//判断本页面是否支持新建:
if (creatableFormTypes.includes(data.BindReviewTableValue)) {
eventId.value = "";
eventCode.value = data.BindReviewTableValue;
visible.value = true;
} else {
centerDialogVisible.value = true;
}
curNodeId.value = null;
preNodeId.value = null;
return;
}
}
console.log("3 preNodeId", preNodeId.value);
preNodeId.value = data.NodeID;
console.log("4 preNodeId", preNodeId.value);
nodeTimer.value = setTimeout(() => {
//300ms内没有第二次点击就把第一次点击的清空
preNodeId.value = null;
nodeCount.value = 0;
}, 300);
getApplyAllList();
};
vue3 Element 双击事件实现
最新推荐文章于 2024-05-23 10:34:45 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)