ant design中table表格提交数据刷新问题
问题描述:在ant design 中table表格中添加一条新的记录,但是表格不刷新数据,第二次提交才刷新出第一条的数据。解决方法:在app.vue中写provide(){return {reload: this.reload}methods中:reload() {this.isRouterAlive = false`在这里插入代...
·
问题描述:在ant design 中table表格中添加一条新的记录,但是表格不刷新数据,第二次提交才刷新出第一条的数据。
解决方法:
在app.vue中写
provide(){
return {
reload: this.reload
}
methods中:
reload() {
this.isRouterAlive = false`在这里插入代码片`
this.$nextTick(function () {
this.isRouterAlive = true
})
}
在你添加表格数据的页面中注入reload
然后在添加数据的方法中引入this.reload() 即可
这样做,因为reload有强制当前页面刷新的功能
如果不需要页面重新刷新一遍,我们可以把提交的数据当作data传给后端。
这样表格提交后自动刷新
更多推荐
已为社区贡献12条内容
所有评论(0)