TabbarFinance.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template >
  2. <view>
  3. <u-tabbar v-model="myCurrent" :list="tabbarList"
  4. :before-switch="beforeSwitch"
  5. active-color="#1677ff"></u-tabbar>
  6. </view>
  7. </template>
  8. <script>
  9. import * as API from '@/apis/role.js'
  10. export default {
  11. name:"tabbarJob",
  12. props:{
  13. current: 0,
  14. },
  15. data() {
  16. return {
  17. tabbarList:API.getList(this.carhelp.getPersonInfo()),
  18. activeColor:"#5098FF",
  19. oldindex:0,
  20. myCurrent:0,
  21. };
  22. },computed:{
  23. currentNum(){
  24. for(var i in this.tabbarList){
  25. var item=this.tabbarList[i]
  26. if(item.current==this.current){
  27. return i;
  28. }
  29. }
  30. return -1;
  31. },
  32. },
  33. methods:{
  34. relist(){
  35. this.tabbarList=API.getList(this.carhelp.getPersonInfo());
  36. this.myCurrent=this.currentNum;
  37. },
  38. setcount(){
  39. // console.log("currentNum")
  40. // console.log(this.currentNum)
  41. this.myCurrent=this.currentNum;
  42. },
  43. beforeSwitch(index){
  44. if(index==this.currentNum){
  45. return false
  46. }
  47. var url =this.tabbarList[index].pagePath2;
  48. uni.navigateTo({
  49. url: url
  50. })
  51. if(index==1){
  52. this.myCurrent=this.oldindex;
  53. return false;
  54. }else{
  55. return true;
  56. }
  57. },
  58. },create(){
  59. }
  60. ,mounted(){
  61. console.log("mounted")
  62. this.myCurrent=this.currentNum;
  63. },destroyed(){
  64. }
  65. }
  66. </script>
  67. <style>
  68. </style>