Tabbar.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template >
  2. <view>
  3. <u-tabbar v-model="myCurrent" mid-button-size="35px" :midButton="true" :list="tabbarList"
  4. :before-switch="beforeSwitch" active-color="#1F4A99" inactive-color="#B3BED1" ></u-tabbar>
  5. </view>
  6. </template>
  7. <script>
  8. var img1=require('@/components/riFill-hearts-fill@1x.png')
  9. var img2=require('@/components/home@1x.png')
  10. var img3=require('@/components/riFill-hearts-fill@.png')
  11. var img4=require('@/components/home@.png')
  12. export default {
  13. name:"tabbarJob",
  14. props:{
  15. current: 0,
  16. elderStatus: false
  17. },
  18. data() {
  19. return {
  20. activeColor:"#1F4A99",
  21. oldindex:this.current,
  22. myCurrent:this.current,
  23. tabbarList: [
  24. {
  25. iconPath: "home",
  26. selectedIconPath: "home-fill",
  27. text: '主页 ',
  28. pagePath2:"/",
  29. login:false,
  30. },
  31. {
  32. iconPath: img3,
  33. selectedIconPath: img1,
  34. textImg:true,
  35. text: img2,
  36. text2: img4,
  37. pagePath2:"/pages/staffHome/staffHome",
  38. midButton:true,
  39. login:true,
  40. },
  41. {
  42. iconPath: "account",
  43. selectedIconPath: "account-fill",
  44. text: '我的',
  45. login:true,
  46. pagePath2:"/pages/mine/mine",
  47. }
  48. ],
  49. };
  50. },methods:{
  51. setcount(c){
  52. //this.myCurrent=c
  53. },
  54. beforeSwitch(index){
  55. var bl=false
  56. if(index==this.current){
  57. return false
  58. }
  59. //this.myCurrent=index
  60. var url =this.tabbarList[index].pagePath2;
  61. if(this.tabbarList[index].login){
  62. var userInfo=this.carhelp.getPersonInfo()
  63. if(userInfo){
  64. }else{
  65. url="/pages/login/index"
  66. bl=true
  67. }
  68. }
  69. uni.navigateTo({
  70. url: url
  71. })
  72. },
  73. },
  74. mounted(){
  75. },destroyed(){
  76. }
  77. }
  78. </script>
  79. <style>
  80. </style>