mirror of
https://github.com/veops/cmdb.git
synced 2025-08-09 07:03:08 +08:00
前后端全面升级
This commit is contained in:
@@ -1,46 +1,70 @@
|
||||
<template>
|
||||
<a-config-provider :locale="locale">
|
||||
<div id="app">
|
||||
<div id="app" :class="{ 'ops-fullscreen': isOpsFullScreen, 'ops-only-topmenu': isOpsOnlyTopMenu }">
|
||||
<router-view v-if="alive" />
|
||||
</div>
|
||||
</a-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/locales'
|
||||
import { mapActions } from 'vuex'
|
||||
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
|
||||
import { AppDeviceEnquire } from '@/utils/mixin'
|
||||
import { mixin } from '@/store/i18n-mixin'
|
||||
import { debounce } from './utils/util'
|
||||
|
||||
export default {
|
||||
mixins: [AppDeviceEnquire, mixin],
|
||||
provide () {
|
||||
mixins: [AppDeviceEnquire],
|
||||
provide() {
|
||||
return {
|
||||
reload: this.reload
|
||||
reload: this.reload,
|
||||
}
|
||||
},
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
locale: {},
|
||||
alive: true
|
||||
locale: zhCN,
|
||||
alive: true,
|
||||
timer: null,
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.$watch('currentLang', () => {
|
||||
this.locale = i18n.getLocaleMessage(this.currentLang).antLocale
|
||||
})
|
||||
computed: {
|
||||
isOpsFullScreen() {
|
||||
return this.$route.name === 'cmdb_screen'
|
||||
},
|
||||
isOpsOnlyTopMenu() {
|
||||
return ['fullscreen_index', 'setting_person'].includes(this.$route.name)
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.timer = setInterval(() => {
|
||||
this.setTime(new Date().getTime())
|
||||
}, 1000)
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('setWindowSize')
|
||||
window.addEventListener(
|
||||
'resize',
|
||||
debounce(() => {
|
||||
this.$store.dispatch('setWindowSize')
|
||||
})
|
||||
)
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.timer)
|
||||
},
|
||||
|
||||
methods: {
|
||||
reload () {
|
||||
...mapActions(['setTime']),
|
||||
reload() {
|
||||
this.alive = false
|
||||
this.$nextTick(() => {
|
||||
this.alive = true
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
<style lang="less">
|
||||
@import './style/index.less';
|
||||
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
|
Reference in New Issue
Block a user