fix: 编辑页-按钮loading

This commit is contained in:
zyn
2023-11-22 17:51:54 +08:00
parent a16169d8a1
commit 38f82beb8a
4 changed files with 19 additions and 4 deletions
@@ -330,7 +330,7 @@
</div>
<div class="drawer-footer">
<el-button icon="el-icon-check" type="primary" @click="onSubmit" :loading="isSubmit">提交</el-button>
<el-button icon="el-icon-close" @click="onClose">取消</el-button>
<el-button icon="el-icon-close" @click="onClose" :loading="isSubmit">取消</el-button>
</div>
</el-drawer>
</template>
@@ -538,6 +538,7 @@ export default {
onSubmit () {
this.$refs.formRef.validate(valid => {
if (valid) {
this.isSubmit = true
if (this.title === '新增') {
this.$http._postData(this.api.add, this.form).then(res => {
if (res.ok) {
@@ -545,6 +546,8 @@ export default {
this.onClose()
this.$emit('load')
}
}).finally(() => {
this.isSubmit = false
})
} else {
this.$http._putData(this.api.update, this.form).then(res => {
@@ -553,6 +556,8 @@ export default {
this.onClose()
this.$emit('load')
}
}).finally(() => {
this.isSubmit = false
})
}
}