<template>
  <el-container>
    <el-aside>
      <el-row>
        <el-col :span="12">
            <el-image src="/circle-star.svg">
            </el-image>
            <h1 class="el-dialog--center"></h1>
              <el-menu @select="selectItem" :router="true" default-active="/document">
                  <el-menu-item :index="localePath('/'+item,$i18n.locale)" v-for="item in menus" :key="item">
                    <template slot="title">
                      <i class="el-icon-location"></i>
                      <span>{{$t("menus."+item)}}</span>
                    </template>
                  </el-menu-item>
              </el-menu>
        </el-col>
      </el-row>
    </el-aside>
    <el-container>
      <el-header>
        <el-row  type="flex" justify="end">
          <el-col>
            <span class="title">{{ $t('app_name') }}</span>
          </el-col>
          <el-col>
            <el-dropdown class="ml4">
              <span class="el-dropdown-link">
                {{$t('choose_lang')}}
                <i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item  v-for="item in ['zhCN', 'en']" :key="item">
                  <nuxt-link v-if="$i18n.locale !== item" :to="switchLocalePath(item)">
                    {{$t(item)}}
                  </nuxt-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-col>
        </el-row>
      </el-header>
      <el-main><nuxt/></el-main>
    </el-container>
  </el-container>
</template>

<script lang="ts">
  export default {
    name: 'mainmenu',
    methods:{
      selectItem(index:string,indexPath:Array<String>){
        console.info(index,indexPath)
      }
    },
    data() {
      return {
        menus:['document','note','center','upload']
      }
    }
  }
</script>
<style>
  .title{
    font-size: 25px;
    font-weight: bold;
  }
</style>
