Tabbar.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. id: 0
  14. },
  15. data() {
  16. return {
  17. activeColor:"#5098FF",
  18. oldindex:this.current,
  19. myCurrent:this.current,
  20. tabbarList: [{
  21. iconPath: "motuoche-diandongche",
  22. selectedIconPath: "motuoche-diandongche",
  23. text: '充电中',
  24. count: 0,
  25. isDot: true,
  26. customIcon: true,
  27. pagePath2:"/pages/index/index?k=1",
  28. },
  29. {
  30. iconPath: "/static/img/min_button_select.png",
  31. selectedIconPath: "/static/img/min_button_select.png",
  32. text: '充电',
  33. midButton: true,
  34. customIcon: true,
  35. pagePath2:"/pages/charge/index",
  36. },
  37. {
  38. iconPath: "31wode",
  39. selectedIconPath: "31wode",
  40. text: '我的',
  41. count: 0,
  42. isDot: false,
  43. customIcon: true,
  44. pagePath2:"/pages/user/index",
  45. },
  46. ],
  47. };
  48. },methods:{
  49. setcount(c){
  50. this.myCurrent=c
  51. },
  52. beforeSwitch(index){
  53. if(index==this.current){
  54. return false
  55. }
  56. var url =this.tabbarList[index].pagePath2;
  57. if(index==1){
  58. var id =this.carhelp.get("qr-default-id");
  59. if(!id){
  60. url="/pages/charge/switchCharge?index=1"
  61. }
  62. }
  63. uni.navigateTo({
  64. url: url
  65. })
  66. if(index==1){
  67. this.myCurrent=this.oldindex;
  68. return false;
  69. }else{
  70. return true;
  71. }
  72. },
  73. },mounted(){
  74. },destroyed(){
  75. }
  76. }
  77. </script>
  78. <style>
  79. </style>