index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="">
  3. <u-sticky bgColor="#fff">
  4. <u-tabs
  5. :list="tabList"
  6. :current="currentTab"
  7. :activeStyle="{
  8. color: '#303133',
  9. fontWeight: 'bold',
  10. transform: 'scale(1.05)',
  11. }"
  12. :lineWidth="tabLineWidth"
  13. :inactiveStyle="{
  14. color: '#606266',
  15. transform: 'scale(1)',
  16. }"
  17. @click="click"
  18. ></u-tabs>
  19. </u-sticky>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. tabList: [
  27. {
  28. id: "over",
  29. name: "超标商户概览",
  30. badge: {
  31. value: 0,
  32. },
  33. },
  34. {
  35. id: "info",
  36. name: "商户设施概览",
  37. },
  38. {
  39. id: "po",
  40. name: "排放总量分析",
  41. },
  42. {
  43. id: "clean",
  44. name: "商户清洗分析",
  45. badge: {
  46. value: 0,
  47. },
  48. },
  49. ],
  50. //currentTab: 0,
  51. tabLineWidth: "110",
  52. };
  53. },
  54. props: {
  55. currentTab: {
  56. type: Number,
  57. default: 0,
  58. },
  59. },
  60. mounted() {
  61. this.changeOverNum(this.$store.state.overNum);
  62. },
  63. methods: {
  64. click(e) {
  65. // #ifndef H5
  66. // switch (e.index) {
  67. // case 0:
  68. // uni.reLaunch({
  69. // url: "/pages/home/home",
  70. // });
  71. // break;
  72. // case 1:
  73. // uni.reLaunch({
  74. // url: "/pages_home/info",
  75. // });
  76. // break;
  77. // case 2:
  78. // uni.reLaunch({
  79. // url: "/pages_home/pollution",
  80. // });
  81. // break;
  82. // case 3:
  83. // uni.reLaunch({
  84. // url: "/pages_home/clean",
  85. // });
  86. // break;
  87. // }
  88. // #endif
  89. // #ifdef H5
  90. //this.$emit("changeIndex", e.index);
  91. //#endif
  92. this.$emit("changeIndex", e.index);
  93. //this.currentTab = e.index;
  94. },
  95. changeOverNum(num) {
  96. num = num || 0;
  97. const overTab = this.tabList.find(a => a.id == "over");
  98. overTab.badge.value = num;
  99. },
  100. },
  101. };
  102. </script>
  103. <style>
  104. .container {
  105. padding: 20px;
  106. font-size: 14px;
  107. line-height: 24px;
  108. }
  109. </style>