import Vue from 'vue'
const preventReClick = Vue.directive('preventReClick', {
inserted: function (el, binding) {
el.addEventListener('click', () => {
if (!el.disabled) {
el.disabled = true
setTimeout(() => {
el.disabled = false
}, binding.value || 3000)
}
})
}
});
export { preventReClick }
引入preventReClick.js到mian.js内
使用<el-button v-preventReClick>提 交</el-button>
VUE确定按钮防止重复点击
最新推荐文章于 2024-09-05 11:38:04 发布