TabbarJob.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template >
  2. <view>
  3. <u-tabbar v-model="myCurrent" :active-color="activeColor" :list="list" :before-switch="beforeSwitch" ></u-tabbar>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. name:"tabbarJob",
  9. props:{
  10. current: {
  11. setIntervalId:'',
  12. require: false,
  13. default: 0,
  14. },
  15. },
  16. data() {
  17. return {
  18. activeColor:"#5098FF",
  19. myCurrent:this.current,
  20. num:0,
  21. list: [{
  22. iconPath: "home",
  23. selectedIconPath: "home",
  24. text: '首页',
  25. customIcon: false,
  26. pagePath2:"/pages/job/index/index"
  27. },
  28. {
  29. iconPath: "/static/img/iconPark-city-one.svg",
  30. selectedIconPath: "/static/img/iconPark-city-one-selected.svg",
  31. text: '企业',
  32. customIcon: false,
  33. pagePath2:"/pages/job/company/index"
  34. },
  35. {
  36. iconPath: "chat",
  37. selectedIconPath: "chat",
  38. text: '消息',
  39. customIcon: false,
  40. count:0,
  41. pagePath2:"/pages/job/newsIndex/newsIndex",
  42. },
  43. {
  44. iconPath: "account",
  45. selectedIconPath: "account",
  46. text: '我的',
  47. pagePath2:"/pages/job/personal/my/my",
  48. customIcon: false,
  49. },
  50. ],
  51. };
  52. },methods:{
  53. beforeSwitch(index){
  54. clearInterval(this.setIntervalId)
  55. if(index==this.current){
  56. return false
  57. }
  58. var url =this.list[index].pagePath2;
  59. uni.navigateTo({
  60. url: url
  61. })
  62. return true;
  63. },
  64. getNum(){
  65. this.list[2].count=this.carhelp.get("tabbar_show_num")
  66. }
  67. },mounted(){
  68. this.getNum()
  69. this.setIntervalId= setInterval(()=>{
  70. this.getNum()
  71. },1000*2)
  72. },destroyed(){
  73. }
  74. }
  75. </script>
  76. <style>
  77. </style>