Browse Source

防止重复点击

master_hella_20240701
wangyufei 5 months ago
parent
commit
a00d7f4151
  1. 18
      src/components/XButton/src/ButtonBase.vue

18
src/components/XButton/src/ButtonBase.vue

@ -73,18 +73,18 @@ const emit = defineEmits(['buttonBaseClick', 'updataTableColumns'])
let timer = ref(null) let timer = ref(null)
const buttonBaseClick = (val, item, $event) => { const buttonBaseClick = (val, item, $event) => {
if(!timer.value){ // if(!timer.value){
timer.value = setTimeout(()=>{ // timer.value = setTimeout(()=>{
if(timer.value){ // if(timer.value){
console.log('清空timer',timer.value) // console.log('timer',timer.value)
clearTimeout(timer.value) // clearTimeout(timer.value)
timer.value = null // timer.value = null
} // }
},2000) // },2000)
clearButtonBlurHandle($event) //el-button clearButtonBlurHandle($event) //el-button
emit('buttonBaseClick', val, item, $event) emit('buttonBaseClick', val, item, $event)
} // }
} }
onUnmounted(() => { onUnmounted(() => {

Loading…
Cancel
Save