<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
  import { getSysInfo } from '@/api/router'
  import { mapActions } from 'vuex'

  export default {
    name: 'App',
    watch: {},
    async created() {
      //初始化信息，必须初始化完成。
      await this.doInitApp()
    },
    methods: {
      ...mapActions({
        //setConfigs: 'routes/setConfigs',
        setTitle: 'settings/setTitle',
      }),
      /**
       * 初始化平台信息
       */
      async doInitApp() {
        const sys_res = await getSysInfo()
        if (sys_res.status == 200) {
          //this.setConfigs(sys_res.data);
          this.setTitle(sys_res.data.name)
        }

        return sys_res
      },
    },
  }
</script>
