Tabbar.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template >
  2. <view>
  3. <u-tabbar v-model="myCurrent" :list="tabbarList"
  4. :before-switch="beforeSwitch" active-color="#0DBAC7" ></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:"#5098FF",
  17. oldindex:this.current,
  18. myCurrent:this.current,
  19. tabbarList: [
  20. {
  21. iconPath: "grid",
  22. selectedIconPath: "grid-fill",
  23. text: '服务 ',
  24. pagePath2:"/pages/teacher/homePage/homePage",
  25. },
  26. {
  27. iconPath: "account",
  28. selectedIconPath: "account-fill",
  29. text: '我的',
  30. pagePath2:"/pages/teacher/mine/mine",
  31. }
  32. ],
  33. };
  34. },methods:{
  35. setcount(c){
  36. this.myCurrent=c
  37. },
  38. beforeSwitch(index){
  39. if(index==this.current){
  40. return false
  41. }
  42. var url =this.tabbarList[index].pagePath2;
  43. uni.navigateTo({
  44. url: url
  45. })
  46. if(index==1){
  47. this.myCurrent=this.oldindex;
  48. return false;
  49. }else{
  50. return true;
  51. }
  52. },
  53. },mounted(){
  54. },destroyed(){
  55. }
  56. }
  57. </script>
  58. <style>
  59. </style>