石墨仪设备 前端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
640 B

6 months ago
6 months ago
6 months ago
6 months ago
  1. <script setup lang="ts">
  2. import { useRouter } from "vue-router";
  3. import { exceptionOb } from "./services/httpRequest";
  4. import { createWebSocket, sharedWsUrl } from "./services/socket";
  5. const router = useRouter();
  6. exceptionOb.subscribe(exp => {
  7. if (exp === "invalidToken") {
  8. router.replace("/login");
  9. }
  10. });
  11. console.log("ws url: ", sharedWsUrl);
  12. const wsClient = createWebSocket(sharedWsUrl);
  13. wsClient.dataOb.subscribe(data => {
  14. console.log(data);
  15. });
  16. wsClient.connect();
  17. </script>
  18. <template>
  19. <div>
  20. <router-view></router-view>
  21. </div>
  22. </template>
  23. <style>
  24. html,
  25. body {
  26. margin: 0;
  27. padding: 0;
  28. box-sizing: border-box;
  29. }
  30. </style>