Tabbar.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. var bl=false
  49. if(index==this.current){
  50. return false
  51. }
  52. var url =this.tabbarList[index].pagePath2;
  53. if(this.tabbarList[index].login){
  54. var userInfo=this.carhelp.getPersonInfo()
  55. if(userInfo){
  56. }else{
  57. url="/pages/login/index"
  58. bl=true
  59. }
  60. }
  61. uni.navigateTo({
  62. url: url
  63. })
  64. if(bl){
  65. this.myCurrent=0;
  66. return false;
  67. }else{
  68. return true;
  69. }
  70. },
  71. },
  72. mounted(){
  73. },destroyed(){
  74. }
  75. }
  76. </script>
  77. <style>
  78. </style>