iheader.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div class="nav">
  3. <ul>
  4. <li :class="{'navfirst': isActive('/login')}">
  5. <a href="#/" @click="goto('/login')"> 回到主页</a>
  6. </li>
  7. <li :class="{'navfirst': isActive('/center/home')}">
  8. <a href="#/center/home" @click="goto('/center/home')"> 学员中心</a>
  9. </li>
  10. <li :class="{'navfirst': isActive('/center/setting')}">
  11. <a href="#/center/setting" @click="goto('/center/setting')">账号设置</a>
  12. </li>
  13. <li :class="{'navfirst': isActive('/center/class/train')}">
  14. <a href="#/center/class/train" @click="goto('/center/class/train')">我的课程</a>
  15. </li>
  16. <li :class="{'navfirst': isActive('/center/market')}">
  17. <a href="#/center/market" @click="goto('/center/market')">推荐课程</a>
  18. </li>
  19. <li :class="{'navfirst': isActive('/center/myOrder')}" >
  20. <a href="#/center/myOrder" @click="goto('/center/myOrder')">我的订单</a>
  21. </li>
  22. <li :class="{'navfirst': isActive('/center/sign')}" >
  23. <a href="#/center/sign" @click="goto('/center/sign')">学时证明</a>
  24. </li>
  25. </ul>
  26. </div>
  27. </template>
  28. <script>
  29. import menu from './menu.js'
  30. export default {
  31. props: {
  32. user: {
  33. type: Object,
  34. default: {
  35. nickanme: ''
  36. }
  37. }
  38. },
  39. data() {
  40. return {
  41. exportLoading: false,
  42. menu:menu,
  43. listLoading: false,
  44. groups: [],
  45. tableData: []
  46. };
  47. },
  48. methods: {
  49. goState( item ){
  50. if( item.children){
  51. this.goSubState( item.children[0] );
  52. }else{
  53. this.goSubState( item );
  54. }
  55. },
  56. goSubState(item){
  57. if(item.path == this.$route.path) return;
  58. this.$router.push(item.path);
  59. },
  60. isActive( path ){
  61. let rpath = this.$route.path;
  62. return rpath.indexOf( path )> -1;
  63. }
  64. }
  65. }
  66. </script>
  67. <style>
  68. @import url("./index.css");
  69. .nav{ height:50px; background:#4679fe; margin:1px auto; width:1009px;}
  70. .nav ul li{ float:left; line-height:50px;}
  71. .nav ul li a{ padding:0 27px; color:#FFF; display:block; height:50px;}
  72. .nav ul li a:hover{ background:#4679fe; text-decoration:none;}
  73. .navfirst a{ background:#ffa200; display:block;}
  74. </style>