页面要实时去抓取数据库和刷新数据:
vue写入:
getData(){
setInterval(()=>{
this.$axios({
url: "http://localhost:8088/teacher/selectTeacherLeave",
method: "post",
data: {}
})
.then(res => {
console.log(res);
if (res.data.code == 200) {
this.tableData = res.data.data;
}
})
.catch(error => {
console.log(error);
});
},5000)
},
5000毫秒就是5秒钟刷新,可以自己定义,但是你要禁用一下你的点击按钮,我这个功能是点击按钮后的请求,如果不禁用按钮会加一层的刷新
禁用按钮操作 v-if:
<el-button type="primary" @click="onclickDaiBanHoliday()" v-if="bind">待办队列{{flowAmongNumBer}}</el-button>
export default {
name: 'entry',
data() {
return {
bind:true,
};
},
onclickDaiBanHoliday(){
this.bind = false;
}
},
};