<template>
<el-dialog :visible="dialogVisible" title="Dialog">
<span>Dialog content</span>
<div slot="footer">
<el-button @click="submit" :disabled="isSubmitting">Submit</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
data() {
return {
dialogVisible: false,
isSubmitting: false,
};
},
methods: {
submit() {
if (this.isSubmitting) {
return;
}
this.isSubmitting = true;
// Your submit logic here
// For example, making an API call
setTimeout(() => {
// Enable the button after a certain amount of time
this.isSubmitting = false;
}, 2000);
},
},
};
</script>
el-dialog 提交按钮防止连点
最新推荐文章于 2024-08-07 17:48:16 发布