看起来您只是在删除服务器上的项目,Vue无法知道这一点。我建议在您发送axios请求之后,您也删除本地州的项目。像这样:
deleteProject(project) {
this.$confirm('Are you sure you want to delete this project? '
+ 'This cannot be undone.', 'Warning', {
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
const request_url = this.url + project.id + '/';
this.$message({
type: 'success',
message: 'Project deleted.'
});
return axios({
method: 'delete',
url: request_url,
id: project.id
}).then(response => {
// Logic to delete local state
const projectIndex = this.projects.findIndex(p => p.id === project.id)
this.projects.splice(projectIndex, 1)
}).catch(function (error) {
console.log(error);
});
}).catch(() => {
return false;
})
}