index.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <!-- :locale="localeLang" -->
  3. <el-config-provider :locale="localeLang">
  4. <div class="tjm_wrapper">
  5. <div class="tjm_warpper_container fixed">
  6. <tjm-side-bar v-if="layoutStyle=='vertical'" />
  7. <div class="tjm_container" :class="{ 'is-collapse': collapse,'is-layoutStyle':layoutStyle=='horizontal' }">
  8. <div
  9. class="header_container fixed-header"
  10. :class="{ 'is-collapse': collapse, 'is-layoutStyle': layoutStyle == 'horizontal' }"
  11. >
  12. <tjm-nav-bar />
  13. <tjm-tabs-bar />
  14. </div>
  15. <div class="content_container">
  16. <tjm-main />
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </el-config-provider>
  22. </template>
  23. <script setup>
  24. import { getConfig, setConfig } from '@/config/config'
  25. import TjmSideBar from './components/SideBar/index.vue'
  26. import TjmNavBar from './components/NavBar/index.vue'
  27. import TjmTabsBar from './components/TabsBar/index.vue'
  28. import TjmMain from './components/Main/index.vue'
  29. import { useSettingStore } from '@/store/settings.js'
  30. const settingStore = useSettingStore()
  31. const { collapse,layoutStyle } = storeToRefs(settingStore)
  32. import { useI18n } from 'vue-i18n'
  33. const { messages, locale, t } = useI18n()
  34. const localeLang = ref(messages[getConfig('globalI18n')])
  35. // 修改element 和 i18n 默认语言
  36. const changeLanguage = () => {
  37. locale.value = getConfig('globalI18n')
  38. localeLang.value = messages.value[locale.value]
  39. }
  40. // 监听修改语言实现element
  41. watchEffect(changeLanguage)
  42. </script>
  43. <style lang="scss" scoped>
  44. @mixin fix-header {
  45. position: fixed;
  46. top: 0;
  47. right: 0px;
  48. z-index: $base-z-index - 2;
  49. width: calc(100% - $base-sidebar-width);
  50. }
  51. .tjm_wrapper {
  52. position: relative;
  53. height: 100%;
  54. width: 100%;
  55. overflow: auto;
  56. .tjm_warpper_container {
  57. &.fixed {
  58. padding-top: calc(#{$base-navbar-height} + #{$base-tabsbar-height});
  59. }
  60. .tjm_container {
  61. min-height: 100%;
  62. margin-left: $base-sidebar-width;
  63. &.is-collapse {
  64. margin-left: $base-sidebar-width-min;
  65. border-right: 0;
  66. }
  67. &.is-layoutStyle {
  68. margin-left: 0;
  69. border-right: 0;
  70. }
  71. .header_container {
  72. box-shadow: 0 1px 4px rgb(0 21 41 / 8%);
  73. &.fixed-header {
  74. @include fix-header;
  75. }
  76. &.is-collapse {
  77. width: calc(100% - $base-sidebar-width-min);
  78. }
  79. &.is-layoutStyle {
  80. width: 100%;
  81. }
  82. }
  83. .content_container {
  84. background: #f7f8fa;
  85. }
  86. }
  87. }
  88. }
  89. </style>