頁面要實時去抓取數據庫和刷新數據:
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;
}
},
};