Tabbar.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template >
  2. <view>
  3. <u-tabbar v-model="myCurrent" :list="tabbarList"
  4. :before-switch="beforeSwitch" active-color="#009143" :height="elderStatus ? '110rpx' : '100rpx'" :icon-size="elderStatus ? '56rpx' : '40rpx'"></u-tabbar>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. name:"tabbarJob",
  10. props:{
  11. current: 0,
  12. elderStatus: false
  13. },
  14. data() {
  15. return {
  16. activeColor:"#5098FF",
  17. oldindex:this.current,
  18. myCurrent:this.current,
  19. tabbarList: [{
  20. iconPath: "home-3-line",
  21. selectedIconPath: "home-3-fill",
  22. text: '主页 ',
  23. count: 0,
  24. isDot: true,
  25. customIcon: true,
  26. pagePath2:"/pages/index/index",
  27. },
  28. {
  29. iconPath: "road-map-line",
  30. selectedIconPath: "road-map-fill",
  31. text: '找桩',
  32. midButton: true,
  33. customIcon: true,
  34. pagePath2:"/pages/searchPile/searchPile",
  35. },
  36. {
  37. iconPath: "user-5-line",
  38. selectedIconPath: "user-5-fill",
  39. text: '我的',
  40. count: 0,
  41. isDot: false,
  42. customIcon: true,
  43. pagePath2:"/pages/user/index",
  44. }
  45. ],
  46. };
  47. },methods:{
  48. setcount(c){
  49. this.myCurrent=c
  50. },
  51. beforeSwitch(index){
  52. if(index==this.current){
  53. return false
  54. }
  55. var url =this.tabbarList[index].pagePath2;
  56. uni.navigateTo({
  57. url: url
  58. })
  59. if(index==1){
  60. this.myCurrent=this.oldindex;
  61. return false;
  62. }else{
  63. return true;
  64. }
  65. },
  66. },mounted(){
  67. },destroyed(){
  68. }
  69. }
  70. </script>
  71. <style>
  72. </style>