From 609d97ddbd0df411ec192b2628da43cace3fc303 Mon Sep 17 00:00:00 2001 From: lijun Date: Sun, 14 Dec 2025 16:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=AD=A3=E5=9C=A8=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E5=AE=9A=E6=97=B6=E5=99=A8=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8A=E6=AC=A1=E6=88=90=E5=8A=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/CIDList.vue | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/views/CIDList.vue b/src/views/CIDList.vue index ccd1daf..8b5f75d 100644 --- a/src/views/CIDList.vue +++ b/src/views/CIDList.vue @@ -17,6 +17,7 @@ export default { tableLoading: false, ip: "", tableData: [], + timer: null, // 定时器 tokenData: { server: localStorage.getItem("cid_server") || "gep.ljsea.xyz", token: localStorage.getItem("token"), @@ -59,6 +60,24 @@ export default { }; }, + watch: { + // 监听 runningDialogVisible 的变化 + runningDialogVisible(newVal) { + if (newVal) { + // 当对话框显示时启动定时器,每秒执行一次 + this.timer = setInterval(() => { + this.GetCIDRuningList(); + }, 1000); + } else { + // 当对话框隐藏时清除定时器 + if (this.timer) { + clearInterval(this.timer); + this.timer = null; + } + } + } + }, + // methods 是一些用来更改状态与触发更新的函数 // 它们可以在模板中作为事件处理器绑定 methods: { @@ -269,6 +288,14 @@ export default { this.getIpClient(); this.getCIDList(); }, + + // 组件销毁前清除定时器 + beforeUnmount() { + if (this.timer) { + clearInterval(this.timer); + this.timer = null; + } + }, }; @@ -468,6 +495,12 @@ export default { show-overflow-tooltip width="100" > +