0510航天交易所ui仿制,代码使用的jiem
lxf
2025-06-30 0d7c0aa6baba05bfeefd7dd7f37e63a9752caf90
当前持仓添加轮询
1 files modified
25 ■■■■■ changed files
src/page/perpetualContract/perpetualHistory.vue 25 ●●●●● patch | view | raw | blame | history
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) => {