<template>
  <div class="loading-box_wrapper" v-show="loading">
    <div class="loading-box">
      <van-loading size="24px" type="spinner" color="#1989fa" vertical>
        <span style="color: #1989fa">加载中...</span>
      </van-loading>
    </div>
  </div>
  <router-view />
</template>

<script>
import { computed, onMounted } from 'vue'
import store from './store'
import { checkPatientId } from './utils/check-patient-id'
export default {
  name: 'App',
  setup() {
    store.commit('SET_WINDOWSIZE', getWindowSize())
    const loading = computed(() => {
      return store.state.loading
    })
    onMounted(() => {
      checkPatientId()
    })
    return { loading }
  },
}

function getWindowSize() {
  const w = window.innerWidth
  const h = window.innerHeight
  const width = w + 'px'
  const height = h + 'px'
  return { w, h, width, height }
}
</script>