vue新增修改完成后页面不刷新问题
这是一开始使用的方法
/*submitReject () {
if (!this.verify()) {
return false
}
if (this.rewData.id && !this.readonly) {
console.log("修改")
update(this.addForm).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '修改成功!'
});
} else {
this.$message.error(res.message);
}
this.close('confirm')
})
} else if (!this.rewData.id ) {
console.log("新增")
insert(this.addForm).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '保存成功!'
});
} else {
this.$message.error(res.message);
}
this.close('confirm')
})
}else{
console.log("close")
}
this.close('confirm')
},*/
修改后自动刷新的方法
/*submitReject () {
if (!this.verify()) {
return false
}
if (this.rewData.id && !this.readonly) {
console.log("修改")
update(this.addForm).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '修改成功!'
});
} else {
this.$message.error(res.message);
}
this.close('confirm')
})
} else if (!this.rewData.id ) {
console.log("新增")
insert(this.addForm).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '保存成功!'
});
} else {
this.$message.error(res.message);
}
this.close('confirm')
})
}else{
console.log("close")
}
this.close('confirm')
},*/
async submitReject () {
if (!this.verify()) {
return false
}
if (this.rewData.id && !this.readonly) {
console.log("修改")
await update(this.addForm)
} else if (!this.rewData.id ) {
console.log("新增")
await insert(this.addForm)
}else{
console.log("close")
}
this.close('confirm')
},