问题描述
我的页面数据出现了需要刷新后才能更新数据,或者需要往复几次才能渲染上去
解决方法
解决方法其实很简单,就是因为你没有清空数据
方法一:直接清空data域
this.judgeData = []
方法二:再次调用接口(数据来自接口)
在这里,我的数据来自
getDetail
而且无法直接使用
方法一
this.getDetail()
// 每次在开始就调用,用接口数据重置
var time = setInterval(() => {
this.checkIndex++
this.getDetail()
curTable[index].topicStatus = this.dataDetail.data.topic_status
if (this.dataDetail.data.topic_status !== '正在测试') {
this.checkIndex = 0
clearInterval(time)
}
if (this.checkIndex >= 10) {
this.checkIndex = 0
clearInterval(time)
this.$message({
type: 'error',
message: '服务器出错,请稍后重试!',
})
curTable[index].topicStatus = '测试失败'
}
}, 1000)