clock.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="bottom_tabbar">
  3. <view v-for="(item,index) in list" :key="index" @tap="changeTabbar(index)">
  4. <image :src="tabbarIndex===index?item.activeImg:item.inactiveImg"></image>
  5. <text :class="{'active':tabbarIndex===index}">{{item.text}}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. tabbarIndex: 0
  13. },
  14. data() {
  15. return {
  16. tabbarValue: 0,
  17. list: [
  18. {
  19. inactiveImg: this.$imgBase+'clockingin/clock_inactive.png',
  20. activeImg: this.$imgBase+'clockingin/clock_active.png',
  21. text: '打卡',
  22. path: '/pagesClockin/index'
  23. },
  24. {
  25. inactiveImg: this.$imgBase+'clockingin/statistics_inactive.png',
  26. activeImg: this.$imgBase+'clockingin/statistics_active.png',
  27. text: '统计',
  28. path: '/pagesStatistics/index'
  29. },
  30. // {
  31. // inactiveImg: this.$imgBase+'clockingin/set_inactive.png',
  32. // activeImg: this.$imgBase+'clockingin/set_active.png',
  33. // text: '设置',
  34. // path: '/pagesSetting/index'
  35. // },
  36. ]
  37. }
  38. },
  39. mounted() {
  40. this.tabbarValue = this.tabbarIndex;
  41. },
  42. methods: {
  43. changeTabbar(e) {
  44. this.tabbarValue = e;
  45. uni.reLaunch({
  46. url: this.list[e].path
  47. })
  48. }
  49. }
  50. }
  51. </script>
  52. <style scoped lang="less">
  53. .bottom_tabbar {
  54. width: 100%;
  55. height: 168rpx;
  56. background: #FFFFFF;
  57. display: flex;
  58. position: fixed;
  59. left: 0;
  60. bottom: 0;
  61. z-index: 999;
  62. padding-top: 10rpx;
  63. box-sizing: border-box;
  64. border-top: 1rpx solid lavender;
  65. &>view {
  66. width: calc(100% / 2);
  67. height: 100%;
  68. display: flex;
  69. flex-direction: column;
  70. align-items: center;
  71. image {
  72. width: 48rpx;
  73. height: 48rpx;
  74. }
  75. text {
  76. margin-top: 6rpx;
  77. font-family: PingFangSC, PingFang SC;
  78. font-weight: 400;
  79. font-size: 24rpx;
  80. color: #86909C;
  81. line-height: 33rpx;
  82. text-align: center;
  83. &.active{
  84. font-weight: bold;
  85. color: #198CFF;
  86. }
  87. }
  88. }
  89. }
  90. </style>