我正在使用async等待来分派操作,但是它在发送表单之前清除了表单输入,并且我最终得到了空值,如何先发送表单,然后再清除表单?
async submit() {
try {
await this.$store.dispatch('AddDelivery', this.form)
} catch (error) {
return
} finally {
this.form.firstName
= this.form.lastName
= this.form.address1
= this.form.address2
= this.form.postcode
= this.form.city
= this.form.phone
='';
}
}
答案 0 :(得分:0)
您的docker service update <NEW_IMAGE>
动作需要返回承诺。然后如下使用
AddDelivery
或
const addDelivery = async function() {
try {
return this.$store.dispatch('AddDelivery', this.form)
} catch (error) {
return
}
}
function submit() {
addDelivery().then(() => {
console.log('Clear data here')
this.form.firstName
= this.form.lastName
= this.form.address1
= this.form.address2
= this.form.postcode
= this.form.city
= this.form.phone
='';
})
}