Tabbar.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. beforeSwitch(index){
  48. if(index==this.current){
  49. return false
  50. }
  51. var url =this.tabbarList[index].pagePath2;
  52. uni.navigateTo({
  53. url: url
  54. })
  55. if(index==1){
  56. this.myCurrent=this.oldindex;
  57. return false;
  58. }else{
  59. return true;
  60. }
  61. },
  62. },mounted(){
  63. },destroyed(){
  64. }
  65. }
  66. </script>
  67. <style>
  68. </style>