Tabbar.vue 1.5 KB

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