TabbarHr.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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:"tabbarHr",
  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. list: [{
  21. iconPath: "home",
  22. selectedIconPath: "home",
  23. text: '首页',
  24. customIcon: false,
  25. pagePath2:"/pages/hr/index/index"
  26. },
  27. {
  28. iconPath: "chat",
  29. selectedIconPath: "chat",
  30. text: '消息',
  31. count:0,
  32. customIcon: false,
  33. pagePath2:"/pages/hr/newsIndex/newsIndex",
  34. },
  35. {
  36. iconPath: "account",
  37. selectedIconPath: "account",
  38. text: '我的',
  39. pagePath2:"/pages/hr/my/my",
  40. customIcon: false,
  41. },
  42. ],
  43. };
  44. },methods:{
  45. beforeSwitch(index){
  46. clearInterval(this.setIntervalId)
  47. if(index==this.current){
  48. return false
  49. }
  50. var url =this.list[index].pagePath2;
  51. uni.navigateTo({
  52. url: url
  53. })
  54. return true;
  55. },
  56. getNum(){
  57. this.list[1].count=this.carhelp.get("tabbar_show_num")
  58. }
  59. },mounted(){
  60. this.getNum()
  61. this.setIntervalId=setTimeout(()=>{
  62. this.getNum()
  63. },1000*2)
  64. },destroyed(){
  65. }
  66. }
  67. </script>
  68. <style>
  69. </style>