tabbar.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!-- tabbar -->
  2. <template name="tab-bar">
  3. <views class="tabbar">
  4. <view class="tabbar-warp" v-for="(item,index) in tabList" :key="index">
  5. <view class="navigator" :class="currentIndex === index ? 'active' : ''" @tap='switchTab(index)'>
  6. <view class="icon">
  7. <image :src="item.icon"></image>
  8. </view>
  9. <view class="test">{{item.text}}</view>
  10. </view>
  11. </view>
  12. </views>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'tabbar',
  17. components: {},
  18. data () {
  19. //这里存放数据
  20. return {
  21. tabList: [
  22. {
  23. icon: 'icon-emotion',
  24. text: 'tab01',
  25. badge: 1
  26. },
  27. {
  28. icon: 'icon-qianbao',
  29. text: 'tab02',
  30. },
  31. {
  32. icon: 'icon-choose01',
  33. text: 'tab03',
  34. badgeDot: true
  35. }
  36. ],
  37. currentIndex: 0,
  38. };
  39. },
  40. //方法集合
  41. methods: {
  42. }
  43. }
  44. </script>
  45. <style lang='less' scoped>
  46. .tabbar {
  47. position: fixed;
  48. bottom: 0;
  49. left: 0;
  50. height: 50upx;
  51. align-items: center;
  52. border-top:1upx solid rgba(0, 0, 0, 0.33);
  53. z-index: 99;
  54. .tabbar-warp {
  55. .navigator {
  56. display: flex;
  57. flex-direction: column;
  58. justify-content: center;
  59. align-items: center;
  60. .icon {
  61. image {
  62. width: 24upx;
  63. height: 24upx;
  64. }
  65. }
  66. .text {
  67. color: rgb(183, 183, 183);
  68. }
  69. }
  70. .active {
  71. transform: scale(1.1);
  72. }
  73. }
  74. }
  75. </style>