fix: 编辑页-按钮loading
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user