From fcb00a66b4053550b473a29d7299c7a4737eea75 Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Wed, 16 Jul 2025 14:41:04 +0800
Subject: [PATCH] 翻译
---
src/page/perpetualContract/perpetualHistory.vue | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/page/perpetualContract/perpetualHistory.vue b/src/page/perpetualContract/perpetualHistory.vue
index f5491fb..d98927d 100644
--- a/src/page/perpetualContract/perpetualHistory.vue
+++ b/src/page/perpetualContract/perpetualHistory.vue
@@ -134,11 +134,24 @@
loading: false,
finished: false,
page: 1,
+ pollTimer: null,
};
},
mounted() {
this.getCoins();
// this.symbol = this.$route.query.symbol;
+ },
+ watch: {
+ type(newVal) {
+ if (newVal === "position") {
+ this.startPolling();
+ } else {
+ this.stopPolling();
+ }
+ },
+ },
+ beforeDestroy() {
+ this.stopPolling();
},
methods: {
getCoins() {
@@ -160,6 +173,18 @@
onClickLeft() {
this.$router.go(-1);
},
+ startPolling() {
+ if (this.pollTimer) return;
+ this.pollTimer = setInterval(() => {
+ this.fetchList(); // 你的轮询方法
+ }, 1500); // 3秒轮询一次,可根据需要调整
+ },
+ stopPolling() {
+ if (this.pollTimer) {
+ clearInterval(this.pollTimer);
+ this.pollTimer = null;
+ }
+ },
async fetchList(symbol) {
if (this.type === "position") {
_orderListHold().then((data) => {
--
Gitblit v1.9.3