修改整体布局
This commit is contained in:
+41
-41
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<a-config-provider :locale="locale">
|
||||
<div id="app">
|
||||
<router-view v-if="isRouterAlive" />
|
||||
<router-view v-if="isRouterAlive"/>
|
||||
</div>
|
||||
</a-config-provider>
|
||||
</template>
|
||||
@@ -11,19 +11,20 @@
|
||||
import enquireScreen from '@/utils/device'
|
||||
import moment from 'moment'
|
||||
import 'moment/locale/zh-cn'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
|
||||
const EN = 'en-us'
|
||||
const ZH = 'zh-cn'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
locale: zhCN,
|
||||
isRouterAlive:true
|
||||
isRouterAlive: true
|
||||
}
|
||||
},
|
||||
created () {
|
||||
created() {
|
||||
let that = this
|
||||
enquireScreen(deviceType => {
|
||||
// tablet
|
||||
@@ -35,67 +36,66 @@
|
||||
else if (deviceType === 1) {
|
||||
that.$store.commit('TOGGLE_DEVICE', 'mobile')
|
||||
that.$store.dispatch('setSidebar', false)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
that.$store.commit('TOGGLE_DEVICE', 'desktop')
|
||||
that.$store.dispatch('setSidebar', true)
|
||||
}
|
||||
})
|
||||
|
||||
// 默认中文
|
||||
localStorage.lang == undefined ? localStorage.setItem("language", "zh-cn") : "";
|
||||
localStorage.lang == undefined ? localStorage.setItem('language', 'zh-cn') : ''
|
||||
// 自己配置多语言适配
|
||||
this.$root.Bus.$on("switchLanguage", value => {
|
||||
let router_path = this.$route.path;
|
||||
this.$root.Bus.$on('switchLanguage', value => {
|
||||
let router_path = this.$route.path
|
||||
switch (value) {
|
||||
case "zh-cn":
|
||||
localStorage.setItem("language", "zh-cn");
|
||||
break;
|
||||
case "en-us":
|
||||
localStorage.setItem("language", "en-us");
|
||||
break;
|
||||
case 'zh-cn':
|
||||
localStorage.setItem('language', 'zh-cn')
|
||||
break
|
||||
case 'en-us':
|
||||
localStorage.setItem('language', 'en-us')
|
||||
break
|
||||
}
|
||||
// 刷新页面
|
||||
this.isRouterAlive = false; //先关闭,
|
||||
this.isRouterAlive = false //先关闭,
|
||||
this.$nextTick(function() {
|
||||
this.isRouterAlive = true; //再打开
|
||||
});
|
||||
this.isRouterAlive = true //再打开
|
||||
})
|
||||
// 系统组件适配
|
||||
let lang = localStorage.language;
|
||||
if (lang == "zh-cn") {
|
||||
this.locale = zhCN;
|
||||
moment.locale("zh-cn");
|
||||
} else if (lang == "en-us") {
|
||||
this.locale = enUS;
|
||||
moment.locale("en-us");
|
||||
let lang = localStorage.language
|
||||
if (lang == 'zh-cn') {
|
||||
this.locale = zhCN
|
||||
moment.locale('zh-cn')
|
||||
} else if (lang == 'en-us') {
|
||||
this.locale = enUS
|
||||
moment.locale('en-us')
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
watch:{
|
||||
$route:function(val) {
|
||||
this.$nextTick(() => {
|
||||
if (document.getElementsByClassName('ant-card-body').length > 0){
|
||||
this.$watermark.set('fanqiangqiang 范强强')
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
watch: {
|
||||
$route: function(val) {
|
||||
this.$nextTick(() => {
|
||||
this.$watermark.set('fanqiangqiang 范强强')
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
|
||||
methods:{
|
||||
|
||||
}
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
body{
|
||||
font-family: "Blue Sky Noto"!important;
|
||||
body {
|
||||
font-family: "Blue Sky Noto" !important;
|
||||
}
|
||||
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.ant-layout {
|
||||
background: transparent !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user