<template>
  <div class="head colorF pad10">
      <h2 class="fl logo" v-if="LanguageShow">{{$t('login.loginBox.headertitle')}}</h2>
    <ul class="fr" v-if="LanguageShow">
      <li>
        <Dropdown trigger="click" @on-click="changeLang">
          <a href="javascript:void(0)">
            {{$t('login.currentLang')}}
            <Icon type="ios-arrow-down"></Icon>
          </a>
          <DropdownMenu slot="list">
            <DropdownItem name="zh-CN">中文简体</DropdownItem>
            <DropdownItem name="zh-TW">中文繁體</DropdownItem>
            <DropdownItem name="EN-US">English</DropdownItem>
          </DropdownMenu>
        </Dropdown>
      </li>
    </ul>
  </div>
</template>

<script>
    export default {
      name: "",
      data () {
        return {
            visible: false,
            LanguageShow:true,
        }
        },
        created() {
            this.languagebtn()
        },
      methods: {
        changeLang(name){//切换语言
          this.$i18n.locale=name;
          localStorage.setItem('local', name);
          if(name==='zh-CN'){
            this.$Message.success('已切换成中文简体');
          }else if(name==='zh-TW'){
            this.$Message.success('已切換成中文簡體');
          }else{
            this.$Message.success('Switched to English');
          }
          },
          languagebtn() {
              let routers = this.$route.path
              if (routers === '/moblielogin') {
                  this.LanguageShow=false
              }
          }
      }
    }
</script>

<style scoped>

</style>
