Tabbar.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. },
  26. {
  27. iconPath: "heart",
  28. selectedIconPath: "heart-fill",
  29. text: '职工之家 ',
  30. pagePath2:"/pages/staffHome/staffHome",
  31. },
  32. {
  33. iconPath: "account",
  34. selectedIconPath: "account-fill",
  35. text: '我的',
  36. pagePath2:"/pages/mine/mine",
  37. }
  38. ],
  39. };
  40. },methods:{
  41. setcount(c){
  42. this.myCurrent=c
  43. },
  44. beforeSwitch(index){
  45. if(index==this.current){
  46. return false
  47. }
  48. var url =this.tabbarList[index].pagePath2;
  49. uni.navigateTo({
  50. url: url
  51. })
  52. if(index==1){
  53. this.myCurrent=this.oldindex;
  54. return false;
  55. }else{
  56. return true;
  57. }
  58. },
  59. },mounted(){
  60. },destroyed(){
  61. }
  62. }
  63. </script>
  64. <style>
  65. </style>