index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="bottom_tabbar">
  3. <view v-for="(item,index) in list" :key="index" @tap="changeTabbar(index)" :class="{'fb':index===1}">
  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+'tab_home1.png',
  20. activeImg: this.$imgBase+'tab_home2.png',
  21. text: '首页',
  22. path: '/pages/home'
  23. },
  24. {
  25. inactiveImg: this.$imgBase+'tab_publish.png',
  26. activeImg: this.$imgBase+'tab_publish.png',
  27. text: '发布问卷',
  28. path: '/pages/publish'
  29. },
  30. {
  31. inactiveImg: this.$imgBase+'tab_user1.png',
  32. activeImg: this.$imgBase+'tab_user2.png',
  33. text: '我的',
  34. path: '/pages/my'
  35. }
  36. ],
  37. loginSuccessUrl:''
  38. }
  39. },
  40. mounted() {
  41. this.tabbarValue = this.tabbarIndex;
  42. },
  43. methods: {
  44. changeTabbar(e) {
  45. this.tabbarValue = e;
  46. uni.reLaunch({
  47. url: this.list[e].path
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style scoped lang="scss">
  54. .bottom_tabbar {
  55. width: 100%;
  56. height: 174rpx;
  57. background-image: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/tab_bg.png');
  58. background-position: left bottom;
  59. background-repeat: no-repeat;
  60. background-size: 100% 100%;
  61. display: flex;
  62. position: fixed;
  63. left: 0;
  64. bottom: 0;
  65. z-index: 999;
  66. &>view {
  67. width: calc(100% / 3);
  68. height: 100%;
  69. display: flex;
  70. flex-direction: column;
  71. align-items: center;
  72. image {
  73. width: 42rpx;
  74. height: 46rpx;
  75. margin-top: 37rpx;
  76. }
  77. &.fb{
  78. image{
  79. width: 72rpx;
  80. height: 72rpx;
  81. margin-top: 12rpx;
  82. }
  83. }
  84. text {
  85. margin-top: 14rpx;
  86. font-family: PingFang-SC, PingFang-SC;
  87. font-weight: bold;
  88. font-size: 22rpx;
  89. color: #7C909F;
  90. line-height: 22rpx;
  91. text-align: center;
  92. &.active{
  93. font-weight: bold;
  94. color: #002846;
  95. }
  96. }
  97. }
  98. }
  99. </style>