index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!-- src/components/BottomNav.vue -->
  2. <template>
  3. <el-menu
  4. :default-active="activeMenu"
  5. mode="horizontal"
  6. class="bottom-nav"
  7. @select="handleSelect"
  8. >
  9. <el-menu-item
  10. v-for="item in navItems"
  11. :key="item.name"
  12. :index="item.name"
  13. >
  14. <i :class="item.icon"></i>
  15. <span>{{ item.label }}</span>
  16. </el-menu-item>
  17. </el-menu>
  18. </template>
  19. <script>
  20. export default {
  21. name: 'BottomNav',
  22. props: {
  23. activeMenu: {
  24. type: String,
  25. default: 'home'
  26. }
  27. },
  28. data() {
  29. return {
  30. navItems: [
  31. { name: 'home', label: '首页', icon: 'el-icon-house', path: '/home' },
  32. { name: 'category', label: '新闻资讯', icon: 'el-icon-news', path: '/menuList' },
  33. { name: 'course', label: '班级课程', icon: 'el-icon-notebook-1', path: '/cart' },
  34. { name: 'mine', label: '会员中心', icon: 'el-icon-user', path: '/mine' }
  35. ]
  36. }
  37. },
  38. methods: {
  39. handleSelect(index) {
  40. const selectedItem = this.navItems.find(item => item.name === index)
  41. if (selectedItem) {
  42. if(selectedItem.name=='course'){
  43. window.open('https://h.xyyxt.net/pages/course/index');
  44. }
  45. else if(selectedItem.name=='mine'){
  46. window.open('https://h.xyyxt.net/pages/wd/index');
  47. }
  48. else{
  49. this.$router.push(selectedItem.path);
  50. }
  51. }
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .bottom-nav {
  58. position: fixed;
  59. bottom: 0;
  60. left: 0;
  61. right: 0;
  62. display: flex;
  63. justify-content: space-around;
  64. height: 90px;
  65. background-color: #6899e6;
  66. border-top: 1px solid #e6e6e6;
  67. z-index: 100;
  68. color:#fff;
  69. }
  70. .bottom-nav .el-menu-item {
  71. display: flex;
  72. flex-direction: column;
  73. justify-content: center;
  74. align-items: center;
  75. height: 100%;
  76. line-height: 40px;
  77. padding: 0 10px;
  78. border-bottom: none !important;
  79. color:#fff;
  80. }
  81. .bottom-nav .el-menu-item i {
  82. font-size: 44px !important;
  83. margin-bottom: 4rpx;
  84. color:#fff;
  85. }
  86. .bottom-nav .el-menu-item.is-active {
  87. color: #f8ff39;
  88. background-color: transparent !important;
  89. i,span{
  90. color: #f8ff39;
  91. }
  92. }
  93. ::v-deep .el-menu--horizontal .el-menu-item{
  94. line-height: 25px;
  95. color:#fff;
  96. }
  97. </style>