tabBar.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view>
  3. <view class="box flex-col justify-end">
  4. <view class="tabbar flex-row justify-around">
  5. <view class="item flex-col justify-center" @click="goPages(0)">
  6. <view class="imageView flex-row justify-center">
  7. <image class="image" :src="tabIndex===0? '/static/tabBar/index_cur.png':'/static/tabBar/index.png'"></image>
  8. </view>
  9. <view class=" flex-row justify-center" :class="tabIndex ===0?'title':'title1'">
  10. <text>首页</text>
  11. </view>
  12. </view>
  13. <!-- <view class="item flex-col justify-center" @click="goPages(1)">-->
  14. <!-- <view class="imageView flex-row justify-center">-->
  15. <!-- <image class="image" :src="tabIndex===1? '/static/tabBar/shop_cur.png':'/static/tabBar/shop.png'"></image>-->
  16. <!-- </view>-->
  17. <!-- <view class=" flex-row justify-center" :class="tabIndex ===1?'title':'title1'">-->
  18. <!-- <text>点单</text>-->
  19. <!-- </view>-->
  20. <!-- </view>-->
  21. <!-- <view class="item flex-col justify-center" @click="goPages(2)">-->
  22. <!-- <view class="qrcodeView flex-row justify-center">-->
  23. <!-- <image class="qrcode" src="/static/tabBar/qrcode.png"></image>-->
  24. <!-- </view>-->
  25. <!-- </view>-->
  26. <view class="item flex-col justify-center" @click="goPages(3)">
  27. <view class="imageView flex-row justify-center">
  28. <image class="image" :src="tabIndex===3? '/static/tabBar/order_cur.png':'/static/tabBar/order.png'"></image>
  29. </view>
  30. <view class=" flex-row justify-center" :class="tabIndex ===3?'title':'title1'">
  31. <text>订单</text>
  32. </view>
  33. </view>
  34. <view class="item flex-col justify-center" @click="goPages(4)">
  35. <view class="imageView flex-row justify-center">
  36. <image class="image" :src="tabIndex===4? '/static/tabBar/me_cur.png':'/static/tabBar/me.png'"></image>
  37. </view>
  38. <view class=" flex-row justify-center" :class="tabIndex ===4?'title':'title1'">
  39. <text>我的</text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. name: "tabBar",
  49. props: {
  50. tabIndex: {
  51. type: Number,
  52. default () {
  53. return 0
  54. }
  55. }
  56. },
  57. data() {
  58. return {
  59. };
  60. },
  61. methods:{
  62. goPages(num){
  63. console.log(num)
  64. if (num === 0){
  65. uni.switchTab({
  66. url:'/pages/index/index'
  67. })
  68. }
  69. if (num === 1){
  70. uni.switchTab({
  71. url:'/pages/orderMeal/index'
  72. })
  73. }
  74. if (num === 2){
  75. uni.switchTab({
  76. url:'/pages/qrCode/index'
  77. })
  78. }
  79. if (num === 3){
  80. uni.switchTab({
  81. url:'/pages/order/index'
  82. })
  83. }
  84. if (num===4){
  85. uni.switchTab({
  86. url:'/pages/my/index'
  87. })
  88. }
  89. }
  90. }
  91. }
  92. </script>
  93. <style>
  94. @import '/common/css/common.css';
  95. .box {
  96. width: 750rpx;
  97. height: 138rpx;
  98. background: #F7F7F7;
  99. }
  100. .tabbar {
  101. width: 750rpx;
  102. height: 108rpx;
  103. background: #FFFFFF;
  104. }
  105. .imageView{
  106. width: 100%;
  107. }
  108. .image {
  109. width: 40rpx;
  110. height: 40rpx;
  111. }
  112. .title{
  113. width: 44rpx;
  114. height: 32rpx;
  115. font-size: 22rpx;
  116. font-family: PingFangSC-Regular, PingFang SC;
  117. font-weight: 400;
  118. color: #333333;
  119. line-height: 32rpx;
  120. }
  121. .title1{
  122. width: 44rpx;
  123. height: 32rpx;
  124. font-size: 22rpx;
  125. font-family: PingFangSC-Regular, PingFang SC;
  126. font-weight: 400;
  127. color: #999999;
  128. line-height: 32rpx;
  129. }
  130. .qrcodeView{
  131. width: 120rpx;
  132. height: 120rpx;
  133. position: relative;
  134. }
  135. .qrcode{
  136. width: 120rpx;
  137. height: 120rpx;
  138. position: absolute;
  139. bottom: 20rpx;
  140. }
  141. </style>