Tabbar.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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:"/",
  25. login:false,
  26. },
  27. {
  28. iconPath: "heart",
  29. selectedIconPath: "heart-fill",
  30. text: '职工之家 ',
  31. pagePath2:"/pages/staffHome/staffHome",
  32. },
  33. {
  34. iconPath: "account",
  35. selectedIconPath: "account-fill",
  36. text: '我的',
  37. login:true,
  38. pagePath2:"/pages/mine/mine",
  39. }
  40. ],
  41. };
  42. },methods:{
  43. setcount(c){
  44. //this.myCurrent=c
  45. },
  46. beforeSwitch(index){
  47. var bl=false
  48. if(index==this.current){
  49. return false
  50. }
  51. //this.myCurrent=index
  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. },
  65. },
  66. mounted(){
  67. },destroyed(){
  68. }
  69. }
  70. </script>
  71. <style>
  72. </style>