Tabbar.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template >
  2. <view>
  3. <u-tabbar v-model="myCurrent" :list="tabbarList"
  4. :inactiveColor="inColor" :bgColor="bgColor"
  5. :before-switch="beforeSwitch" :activeColor="acColor" :height="elderStatus ? '110rpx' : '100rpx'" :icon-size="elderStatus ? '56rpx' : '40rpx'"></u-tabbar>
  6. </view>
  7. </template>
  8. <script>
  9. var img1=require('@/assets/img/riLine-vip-crown-2-line.svg')
  10. var img2=require('@/assets/img/riFill-vip-crown-2-fill.svg')
  11. var img3=require('@/assets/img/buy/riFill-gift-fill.svg')
  12. var img4=require('@/assets/img/buy/riLine-gift-line.svg')
  13. export default {
  14. name:"tabbarJob",
  15. props:{
  16. current: 0,
  17. elderStatus: false,
  18. bgColor: {
  19. type: String,
  20. default: '#ffffff'
  21. },
  22. inColor: {
  23. type: String,
  24. default: '#A8B0AD'
  25. },
  26. acColor: {
  27. type: String,
  28. default: '#009143'
  29. },
  30. },
  31. data() {
  32. return {
  33. activeColor:"#5098FF",
  34. oldindex:this.current,
  35. myCurrent:this.current,
  36. tabbarList: [{
  37. iconPath: "home-3-line",
  38. selectedIconPath: "home-3-fill",
  39. text: '主页 ',
  40. count: 0,
  41. isDot: true,
  42. customIcon: true,
  43. pagePath2:"/pages/index/index",
  44. },
  45. {
  46. // iconPath: img4,
  47. // selectedIconPath: img3,
  48. iconPath: "gift",
  49. selectedIconPath: "gift-fill",
  50. text: '活动',
  51. midButton: true,
  52. //customIcon: true,
  53. pagePath2:"/pages/index/activity",
  54. },
  55. {
  56. iconPath: "road-map-line",
  57. selectedIconPath: "road-map-fill",
  58. text: '找桩',
  59. midButton: true,
  60. customIcon: true,
  61. pagePath2:"/pages/searchPile/searchPile",
  62. },
  63. {
  64. iconPath: "user-5-line",
  65. selectedIconPath: "user-5-fill",
  66. text: '我的',
  67. count: 0,
  68. isDot: false,
  69. customIcon: true,
  70. pagePath2:"/pages/user/index",
  71. }
  72. ],
  73. };
  74. },methods:{
  75. setcount(c){
  76. this.myCurrent=c
  77. },
  78. beforeSwitch(index){
  79. if(index==this.current){
  80. return false
  81. }
  82. var url =this.tabbarList[index].pagePath2;
  83. uni.navigateTo({
  84. url: url
  85. })
  86. if(index==1){
  87. this.myCurrent=this.oldindex;
  88. return false;
  89. }else{
  90. return true;
  91. }
  92. },
  93. },mounted(){
  94. },destroyed(){
  95. }
  96. }
  97. </script>
  98. <style>
  99. </style>