因为没有reload,vue是动态加载技术,所以只要再度调用数据查询函数,把数据更新之后,页面数据自动改变。
created() {
this.findPersonInfo()
},
methods : {
findPersonInfo(){
axios.get('http://localhost:8002/findAll').then(({data}) => {
this.PersonList = data;
})
},
handleDelete(row){
axios.post('http://localhost:8002/deleteInfo',qs.stringify({
'id' : row.id
})).then(() => {
this.findPersonInfo()
})
}
}
删除人员信息之后再调用加载人员信息的函数 this.findPersonInfo()。
本文介绍了Vue.js的动态加载特性,通过实例展示了在删除人员信息后如何利用axios调用API更新数据,实现页面自动刷新。核心操作包括使用axios进行HTTP请求,以及在删除成功后重新调用数据查询函数findPersonInfo(),以实时反映数据变化。
4491

被折叠的 条评论
为什么被折叠?



