Tabbar.vue 1.5 KB

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