11
This commit is contained in:
@@ -25,28 +25,28 @@
|
||||
class="el-menu-vertical-demo"
|
||||
@open="handleOpen"
|
||||
@close="handleClose">
|
||||
<el-menu-item index="1">
|
||||
<span slot="title">学院首页</span>
|
||||
<el-menu-item index="1" @click="home">
|
||||
<span slot="title">{{ $t('message.home') }}</span>
|
||||
</el-menu-item>
|
||||
<el-submenu :index="menuIndex+2" v-for="(menu,menuIndex) in menuData" :key="menuIndex">
|
||||
<template slot="title" >
|
||||
<span v-if="!english">{{ menu.title }}</span>
|
||||
<span v-if="english">{{ menu.title }}</span>
|
||||
<span v-if="$i18n.locale === 'cn'">{{ menu.title }}</span>
|
||||
<span v-if="$i18n.locale === 'en'">{{ menu.englishTitle }}</span>
|
||||
</template>
|
||||
<el-submenu :index="menuIndex +'-'+itemIndex" v-for="(item,itemIndex) in menu.children" :key="itemIndex" >
|
||||
|
||||
<template slot="title" v-if="item.children.length == 0 && !english">
|
||||
<template slot="title" v-if="item.children.length == 0 && $i18n.locale === 'cn'">
|
||||
<span @click="clickSecondMenu(item)">{{item.title}}</span>
|
||||
</template>
|
||||
<template slot="title" v-if="item.children.length == 0&& english">
|
||||
<template slot="title" v-if="item.children.length == 0&& $i18n.locale === 'en'">
|
||||
<span @click="clickSecondMenu(item)">{{item.englishTitle}}</span>
|
||||
</template>
|
||||
|
||||
<template slot="title" v-if="item.children.length > 0 &&!english " >{{item.title}}</template>
|
||||
<template slot="title" v-if="item.children.length > 0 && english" >{{item.englishTitle}}</template>
|
||||
<template slot="title" v-if="item.children.length > 0 &&$i18n.locale === 'cn' " >{{item.title}}</template>
|
||||
<template slot="title" v-if="item.children.length > 0 && $i18n.locale === 'en'" >{{item.englishTitle}}</template>
|
||||
<el-menu-item v-for="(chile ,chileIndex) in item.children" :key="chileIndex" :index="menuIndex +'-'+itemIndex +'-' +chileIndex" @click="clickMenu(chile,item)">
|
||||
<span v-if="!english">{{ chile.title }}</span>
|
||||
<span v-if="english">{{ chile.title }}</span>
|
||||
<span v-if="$i18n.locale === 'cn'">{{ chile.title }}</span>
|
||||
<span v-if="$i18n.locale === 'en'">{{ chile.englishTitle }}</span>
|
||||
</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-submenu>
|
||||
@@ -67,7 +67,6 @@ export default {
|
||||
return {
|
||||
drawer: false,
|
||||
direction: 'ltr',
|
||||
english : false,
|
||||
mobile:document.documentElement.clientWidth <=992,
|
||||
menuData:[],
|
||||
};
|
||||
@@ -81,25 +80,28 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
home(){
|
||||
this.$router.push("/home?lang="+sessionStorage.getItem("lang"))
|
||||
},
|
||||
clickSecondMenu(menu){
|
||||
this.drawer = false
|
||||
this.$router.push("/mobile/" +menu.encodeId+"?type="+menu.type);
|
||||
this.$router.push("/mobile/" +menu.encodeId+"?type="+menu.type+"&lang="+sessionStorage.getItem("lang"));
|
||||
|
||||
},
|
||||
clickMenu(menu,parent){
|
||||
this.drawer = false
|
||||
this.$router.push("/mobile/" +parent.encodeId+"/"+menu.encodeId);
|
||||
this.$router.push("/mobile/" +parent.encodeId+"/"+menu.encodeId+"&lang="+sessionStorage.getItem("lang"));
|
||||
},
|
||||
switchLang() {
|
||||
let lang = ''
|
||||
if (this.$i18n.locale === 'en') {
|
||||
lang = 'cn'
|
||||
this.english = false;
|
||||
} else {
|
||||
this.english = true;
|
||||
lang = 'en'
|
||||
}
|
||||
this.$i18n.locale = lang;
|
||||
sessionStorage.setItem("lang",lang)
|
||||
let fullPath = this.$route.fullPath
|
||||
window.location.replace(fullPath.substr(0,fullPath.length-2)+lang)
|
||||
},
|
||||
handleOpen(key, keyPath) {
|
||||
console.log(key, keyPath);
|
||||
|
||||
Reference in New Issue
Block a user