Tab.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="bottom top-border">
  3. <view class="nav-box">
  4. <view class="nav-tab" @click="toIndex(0)">
  5. <view class="nav-icon">
  6. <image :src="businessHighlightUrl" v-if="index === 0" class="home-img image"></image>
  7. <image :src="business" v-else class="home-img image"></image>
  8. </view>
  9. <view class="nav-text" :class="{textColor:index === 0}">
  10. 首页
  11. </view>
  12. </view>
  13. <view class="nav-tab" @click="toIndex(1)">
  14. <view class="nav-icon">
  15. <image :src="homeHighlightUrl" v-if="index === 1" class="home-img image"></image>
  16. <image :src="homeUrl" v-else class="home-img image"></image>
  17. </view>
  18. <view class="nav-text" :class="{textColor:index === 1}">
  19. 我的事务
  20. </view>
  21. </view>
  22. <view class="nav-tab" @click="toIndex(2)">
  23. <view class="nav-icon">
  24. <image :src="newsHighlightUrl" v-if="index === 2" class="home-img image"></image>
  25. <image :src="newsUrl" v-else class="home-img image"></image>
  26. </view>
  27. <view class="nav-text" :class="{textColor:index === 2}">
  28. 福航动态
  29. </view>
  30. </view>
  31. <view class="nav-tab" @click="toIndex(3)">
  32. <view class="nav-icon">
  33. <image :src="myHighlightUrl" v-if="index === 3" class="home-img image"></image>
  34. <image :src="myUrl" v-else class="home-img image"></image>
  35. </view>
  36. <view class="nav-text" :class="{textColor:index === 3}">
  37. 个人中心
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. props: {
  46. index: {},
  47. },
  48. components: {},
  49. data() {
  50. return {
  51. // index: 0,
  52. business: require('@/static/tabBar/business.png'),
  53. businessHighlightUrl: require('@/static/tabBar/business-highlight.png'),
  54. myUrl: require('@/static/tabBar/my.png'),
  55. myHighlightUrl: require('@/static/tabBar/my-highlight.png'),
  56. homeUrl: require('@/static/tabBar/home.png'),
  57. homeHighlightUrl: require('@/static/tabBar/home-highlight.png'),
  58. newsUrl: require('@/static/tabBar/news.png'),
  59. newsHighlightUrl: require('@/static/tabBar/news-highlight.png'),
  60. }
  61. },
  62. onLoad() {
  63. },
  64. methods: {
  65. toIndex(index) {
  66. // this.index = index
  67. this.$emit('toIndex', index)
  68. }
  69. }
  70. }
  71. </script>
  72. <style scoped lang="scss">
  73. .bottom {
  74. position: fixed;
  75. bottom: 0;
  76. left: 0;
  77. width: 100vw;
  78. height: 49px;
  79. background: #fff;
  80. z-index: 999;
  81. .nav-box {
  82. display: flex;
  83. justify-content: space-around;
  84. align-items: center;
  85. height: 100%;
  86. }
  87. }
  88. .nav-tab {
  89. display: flex;
  90. flex-direction: column;
  91. align-items: center;
  92. width: 50px;
  93. .image {
  94. display: block;
  95. width: 24px;
  96. height: 24px;
  97. }
  98. .nav-text {
  99. color: #999999;
  100. margin-top: 3px;
  101. font-size: 10px;
  102. }
  103. .textColor {
  104. color: #C79F6C;
  105. }
  106. }
  107. </style>