<template>
  <el-config-provider :locale="elLocale">
    <div class="portal-app">
      <layout v-if="isWithLayout" />
      <router-view v-else />
    </div>
  </el-config-provider>
</template>

<script lang="ts">
import Layout from './layout/index.vue'
import { useSettingsStore } from './store/settings'
import { computed, defineComponent } from 'vue-demi'
import router from 'common/utils/router'
import { getElLocale } from 'common/utils/element'

export default defineComponent({
  name: 'AppIndex',
  components: {
    Layout
  },
  setup () {
    const isWithLayout = computed(() => router.currentRoute.value.meta?.layout !== false)

    const settings = useSettingsStore()
    const elLocale = computed(() => getElLocale(settings.locale))

    return {
      elLocale,
      isWithLayout
    }
  }
})

</script>
