header.vue 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <nav class="client-head">
  3. <div class="client-container head-layout">
  4. <div class="head-left">
  5. <a :href="`${baseUrl}`"></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. <a rel="nofollow" href="https://cdnks.mtavip.com/a/register?flug=1" target="_blank">免费试用</a>
  29. <a class="right-tel-btn" href="http://p.qiao.baidu.com/cps/chat?siteId=11735491&amp;userId=10530011" target="_blank"><i></i>4000-522-130</a>
  30. </div>
  31. </div>
  32. </nav>
  33. </template>
  34. <script>
  35. import mtaLink from '~/components/mtaLink/index';
  36. import { mapGetters } from 'vuex';
  37. let _ = require('lodash');
  38. export default {
  39. name: 'mtaHeader',
  40. components: {
  41. mtaLink,
  42. },
  43. computed: {
  44. activeNav() {
  45. return this.getActiveNav;
  46. },
  47. baseUrl() {
  48. return this.getBaseUrl;
  49. },
  50. ...mapGetters(['getActiveNav','getBaseUrl'])
  51. },
  52. data() {
  53. return {
  54. headerArr: [
  55. {
  56. content: '首页',
  57. keyPath: '/',
  58. },
  59. {
  60. content: '考试系统',
  61. keyPath: '/examsystem',
  62. children: [],
  63. },
  64. {
  65. content: '培训系统',
  66. keyPath: '/trainsystem',
  67. children: [],
  68. },
  69. {
  70. content: '课程开发',
  71. keyPath: '/courseware',
  72. children: [],
  73. },
  74. {
  75. content: '新闻资讯',
  76. keyPath: '/news',
  77. children: [],
  78. },
  79. /* {
  80. content: '帮助中心',
  81. keyPath: '/helpCenter',
  82. children: [],
  83. },*/
  84. {
  85. content: '关于我们',
  86. keyPath: '/introduction',
  87. children: [],
  88. },
  89. ],
  90. };
  91. },
  92. };
  93. </script>