From 754c6dc3f52fb428e1824f0ad0d6eaa8cfcaeed8 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Mon, 16 Dec 2024 18:20:13 +0800 Subject: [PATCH] 1 --- src/views/system/DashboardComponents/toDo.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/views/system/DashboardComponents/toDo.vue b/src/views/system/DashboardComponents/toDo.vue index ef26cd2..4f164fb 100644 --- a/src/views/system/DashboardComponents/toDo.vue +++ b/src/views/system/DashboardComponents/toDo.vue @@ -97,6 +97,7 @@ export default { page: 1, page_size: 10 }, + timer: null, tableHeight: 120, loading: false, list: [], @@ -132,18 +133,21 @@ export default { } }, created() { - this.getNotices() + this.getNotices(true) + setInterval(this.getNotices, 5000) + }, + beforeDestroy() { + clearInterval(this.timer) }, mounted() { this.init() }, methods: { - test() { - console.log(this.list.abc.ddd) - }, - async getNotices() { + async getNotices(loading=false) { try { - this.loading = true + if (loading) { + this.loading = true + } const res = await axios.get(`${process.env.VUE_APP_BASE_API}/api/notification/todo`, { headers: { 'Authorization': `Bearer ${getToken()}`