header.vue 2.5 KB

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