<template>
  <div id="app" style="background-color:#0e2e87" v-if="$route.meta.bigScreen">
    <router-view />
    <global-loading ref="globalLoading" />
  </div>
  <div id="app" v-else>
    <router-view :key="language"/>
    <theme-picker />
    <global-loading ref="globalLoading" />
  </div>
</template>

<script>
import ThemePicker from "@/components/ThemePicker";
import GlobalLoading from '@/components/GlobalLoading'

export default {
  name: "App",
  components: { ThemePicker, GlobalLoading },
  metaInfo() {
    return {
      title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
      titleTemplate: title => {
        return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
      }
    }
  },
  computed:{
    language(){
      return this.$store.state.settings.language
    }
  },
  mounted() {
    // 将loading方法挂载到全局，方便在任何组件中调用
    this.$root.$loading = this.$refs.globalLoading
  }
};
</script>

<style scoped>
#app .theme-picker {
  display: none;
}
</style>
