<script setup> import { ref } from 'vue' let timer = ref('') const handleClick= () => { if(timer.value) { clearTimeout(timer.value) } timer.value = setTimeout(() => { console.log('单击事件') //你的操作 }, 300) } const handleDblClick= () => { if(timer.value) { clearTimeout(timer.value) } console.log('双击事件');
//你的操作 } </script> <template> <div @click="handleClick" @dblclick="handleDblClick">示例</div> </template>
标签:const,log,单击,timer,value,Vue3,双击 From: https://www.cnblogs.com/reround/p/16783477.html