header.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <nav class="client-head">
  3. <div class="client-container head-layout">
  4. <div class="head-left">
  5. <a>
  6. <i></i>
  7. </a>
  8. <el-menu
  9. :default-active="activeNav"
  10. class="el-menu-demo"
  11. mode="horizontal"
  12. :router="false"
  13. >
  14. <template v-for="(item,index) in headerArr">
  15. <el-submenu :index="`${item.keyPath}`" v-if="item.children && item.children.length > 0"
  16. popper-class="mta-menu-two">
  17. <template slot="title">{{item.content}}</template>
  18. <el-menu-item :index="`${child.keyPath}`" v-for="child of item.children"
  19. :key="child.keyPath">
  20. <mtaLink :path="child.keyPath" :instation="true" :content="child.content"></mtaLink>
  21. </el-menu-item>
  22. </el-submenu>
  23. <el-menu-item :index="`${item.keyPath}`" v-else>
  24. <mtaLink :path="item.keyPath" :instation="true" :content="item.content"></mtaLink>
  25. </el-menu-item>
  26. </template>
  27. </el-menu>
  28. </div>
  29. <div class="head-right">
  30. <i></i><span>4000-522-130</span>
  31. </div>
  32. </div>
  33. </nav>
  34. </template>
  35. <script>
  36. import mtaLink from '~/components/mtaLink/index';
  37. import { mapGetters } from 'vuex';
  38. let _ = require('lodash');
  39. export default {
  40. name: 'mtaHeader',
  41. components: {
  42. mtaLink,
  43. },
  44. computed: {
  45. activeNav() {
  46. return this.getActiveNav;
  47. },
  48. ...mapGetters(['getActiveNav'])
  49. },
  50. data() {
  51. return {
  52. headerArr: [
  53. {
  54. content: '首页',
  55. keyPath: '/',
  56. },
  57. {
  58. content: '考试平台',
  59. keyPath: '/examsystem',
  60. children: [],
  61. },
  62. {
  63. content: '培训平台',
  64. keyPath: '/trainsystem',
  65. children: [],
  66. },
  67. {
  68. content: '课程开发',
  69. keyPath: '/courseware',
  70. children: [],
  71. },
  72. {
  73. content: '新闻资讯',
  74. keyPath: '/news',
  75. children: [],
  76. },
  77. /* {
  78. content: '帮助中心',
  79. keyPath: '/helpCenter',
  80. children: [],
  81. },*/
  82. {
  83. content: '关于我们',
  84. keyPath: '/introduction',
  85. children: [],
  86. },
  87. ],
  88. };
  89. },
  90. };
  91. </script>