<template>
  <el-dropdown
    style="height:50px;line-height: 60px;"
    @command="handleSetLanguage"
  >

    <span class="el-dropdown-link">
      <svg-icon icon-class="language" style="font-size:25px;margin:0 10px;" />
      <!-- {{ language==='zh'?'语言：中文':'Language: English' }} -->
      <!-- <i class="el-icon-arrow-down el-icon--right" /> -->
    </span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item
        :disabled="language==='zh'"
        command="zh"
      >中文
      </el-dropdown-item>
      <el-dropdown-item
        :disabled="language==='en'"
        command="en"
      >English
      </el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
import { mapGetters, mapMutations } from 'vuex'
import Vue from 'vue'
export default {
  name: 'TopLang',

  data() {
    return {}
  },
  computed: {
    ...mapGetters({
      language: 'language'
    })
  },
  methods: {
    ...mapMutations({ setLanguage: 'lang/setLanguage' }),
    handleSetLanguage(lang) {
      this.$i18n.locale = lang
      this.setLanguage(lang)
      this.$updateDictionary()
      console.log(Vue)
      this.$upload()
      // window.location.reload()
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
