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"
>
+