App.vue 919 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <div class="loading-box_wrapper" v-show="loading">
  3. <div class="loading-box">
  4. <van-loading size="24px" type="spinner" color="#1989fa" vertical>
  5. <span style="color: #1989fa">加载中...</span>
  6. </van-loading>
  7. </div>
  8. </div>
  9. <router-view />
  10. </template>
  11. <script setup>
  12. import { computed } from 'vue'
  13. import store from './store'
  14. const loading = computed(() => {
  15. return store.state.loading
  16. })
  17. function getScreenSize() {
  18. const w = window.innerWidth
  19. const h = window.innerHeight
  20. const width = w + 'px'
  21. const height = h + 'px'
  22. return { w, h, width, height }
  23. }
  24. {
  25. store.dispatch({
  26. type: 'storeScreenSize',
  27. screenSize: getScreenSize()
  28. })
  29. let localCards = localStorage.getItem('patientCards')
  30. if (localCards) {
  31. let cardList = JSON.parse(localCards)
  32. store.dispatch({
  33. type: 'storePatientCardsOnly',
  34. cards: cardList
  35. })
  36. }
  37. }
  38. </script>