Tabbar.vue 1.4 KB

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