suerprisePlus
2024-10-14 f521ebc2551d468c4c478783a18d4b0714394d61
src/App.vue
@@ -24,14 +24,39 @@
  },
  data() {
    return {
    }
  },
  mounted() {
    this.createSocket();
    setTimeout(() => {
      this.$store.state.mapLayers.msgList.push({
        msg: "变压器故障",
        point: "POINT (112.56978672907 37.8558881392881)"
      })
    }, 10000);
  },
  methods: {
    createSocket() {
      this.wsSocket = new WebSocket(config.pySocket);
      this.wsSocket.onopen = (event) => {
        console.log('WebSocket连接成功');
      };
      this.wsSocket.onmessage = (event) => {
        // console.log('Received message:', event.data);
        if (event.data != "连接成功") {
          const obj = JSON.parse(event.data)
          this.leftChartData = {
            type: 'left1',
            val: obj
          }
        }
      };
    }
  }
};
</script>