canteenTabbar.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template >
  2. <view>
  3. <u-tabbar v-model="myCurrent" :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/bar-chart-box-fill 1.png')
  9. var img2=require('@/components/bar-chart-box-fill 2.png')
  10. var img3=require('@/components/file-list-3-fill.png')
  11. var img4=require('@/components/file-list-3-fill (1).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: img2,
  26. selectedIconPath: img1,
  27. text: '数据统计 ',
  28. pagePath2:"/pages/canteenManagement/dataStatistics/dataStatistics",
  29. login:false,
  30. },
  31. {
  32. iconPath: img4,
  33. selectedIconPath: img3,
  34. text: '消费明细 ',
  35. login:true,
  36. pagePath2:"/pages/canteenManagement/consumption/consumption",
  37. },
  38. {
  39. iconPath: "account",
  40. selectedIconPath: "account-fill",
  41. text: '个人中心',
  42. login:true,
  43. pagePath2:"/pages/canteenManagement/mine/mine",
  44. }
  45. ],
  46. };
  47. },methods:{
  48. setcount(c){
  49. //this.myCurrent=c
  50. },
  51. beforeSwitch(index){
  52. var bl=false
  53. if(index==this.current){
  54. return false
  55. }
  56. //this.myCurrent=index
  57. var url =this.tabbarList[index].pagePath2;
  58. if(this.tabbarList[index].login){
  59. var userInfo=this.carhelp.getPersonInfo()
  60. if(userInfo){
  61. }else{
  62. url="/pages/login/index"
  63. bl=true
  64. }
  65. }
  66. uni.navigateTo({
  67. url: url
  68. })
  69. },
  70. },
  71. mounted(){
  72. },destroyed(){
  73. }
  74. }
  75. </script>
  76. <style>
  77. </style>