Tabbar.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. },
  40. {
  41. iconPath: "account",
  42. selectedIconPath: "account-fill",
  43. text: '我的',
  44. login:true,
  45. pagePath2:"/pages/mine/mine",
  46. }
  47. ],
  48. };
  49. },methods:{
  50. setcount(c){
  51. //this.myCurrent=c
  52. },
  53. beforeSwitch(index){
  54. var bl=false
  55. if(index==this.current){
  56. return false
  57. }
  58. //this.myCurrent=index
  59. var url =this.tabbarList[index].pagePath2;
  60. if(this.tabbarList[index].login){
  61. var userInfo=this.carhelp.getPersonInfo()
  62. if(userInfo){
  63. }else{
  64. url="/pages/login/index"
  65. bl=true
  66. }
  67. }
  68. uni.navigateTo({
  69. url: url
  70. })
  71. },
  72. },
  73. mounted(){
  74. },destroyed(){
  75. }
  76. }
  77. </script>
  78. <style>
  79. </style>