1
PC-20250623MANY\Administrator
2025-08-24 1b8ed300551b88bd86b80b8dfa52d2d6c2b7fdb2
1
1 files modified
20 ■■■■ changed files
src/components/stock-list.vue 20 ●●●● patch | view | raw | blame | history
src/components/stock-list.vue
@@ -77,7 +77,7 @@
      pageNum: 1,
      pageSize: 10,
      total: 1,
      stockList: [],
      stockList: []
    };
  },
  props: {
@@ -101,9 +101,16 @@
  watch: {
    propOption: {
      handler(val) {
        // 根据当前股票类型连接对应的ws
        if (val.stockType == "US")
          this.initWebSocket("wss://usws.yanshiz.com/websocket-server");
        else this.initWebSocket("wss://ws.acapl.net/websocket-server");
        this.pageNum = 1;
        this.getStockList();
      }
      },
      deep: true,
      immediate: true
    },
    pageNum: {
      handler(val) {
@@ -114,7 +121,7 @@
  },
  mounted() {
    this.getStockList();
    this.initWebSocket();
    // this.initWebSocket();
  },
  methods: {
    // 获取数据
@@ -165,10 +172,13 @@
      }
    },
    // 连接ws实时监控变动
    initWebSocket() {
    initWebSocket(url) {
      console.log("initWebSocket");
      if (this.Trade) {
        this.Trade.close();
      }
      this.Trade = new WhrWebSocket({
        path: `wss://ws.acapl.net/websocket-server `,
        path: url,
        onmessage: this.getTradeMessage
      });