App.vue 871 B

12345678910111213141516171819202122232425262728293031323334353637
  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>
  12. import { computed, onMounted } from 'vue'
  13. import store from './store'
  14. import { checkPatientId } from './utils/check-patient-id'
  15. export default {
  16. name: 'App',
  17. setup() {
  18. store.commit('SET_WINDOWSIZE', getWindowSize())
  19. const loading = computed(() => {
  20. return store.state.loading
  21. })
  22. onMounted(() => {
  23. checkPatientId()
  24. })
  25. return { loading }
  26. },
  27. }
  28. function getWindowSize() {
  29. const w = window.innerWidth
  30. const h = window.innerHeight
  31. const width = w + 'px'
  32. const height = h + 'px'
  33. return { w, h, width, height }
  34. }
  35. </script>