<button @click="save" :disabled="isSaving">保存</button>
data() {
return {
isSaving: false
};
},
methods: {
async save() {
if (this.isSaving) {
return; // 如果正在保存,则直接返回
}
this.isSaving = true; // 设置正在保存的标志位
try {
// 执行保存操作
await this.performSaveOperation();
} catch (error) {
// 处理错误
console.error(error);
}
this.isSaving = false; // 保存完成后恢复标志位
}
}
连续点击多次保存按钮,重复添加数据 保存 vue
最新推荐文章于 2024-01-17 13:08:31 发布