index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div class="health">
  3. <div class="selections mg-b-16">
  4. <div
  5. class="item"
  6. @click="tabSelect(0)"
  7. :class="{ active: tabIndex == 0 }"
  8. >
  9. 总功率情况
  10. </div>
  11. <div
  12. class="item"
  13. @click="tabSelect(1)"
  14. :class="{ active: tabIndex == 1 }"
  15. >
  16. 月功率情况
  17. </div>
  18. <div
  19. class="item"
  20. @click="tabSelect(2)"
  21. :class="{ active: tabIndex == 2 }"
  22. >
  23. 日功率情况
  24. </div>
  25. </div>
  26. <div class="curHeight" v-if="tabIndex == 0">
  27. <Tab1 />
  28. </div>
  29. <div class="curHeight" v-if="tabIndex == 1">
  30. <Tab2 />
  31. </div>
  32. <div class="curHeight" v-if="tabIndex == 2">
  33. <Tab3 />
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import Tab1 from "./tab1.vue";
  39. import Tab2 from "./tab2.vue";
  40. import Tab3 from "./tab3.vue";
  41. export default {
  42. // 名称
  43. name: "wtSaturability",
  44. // 使用组件
  45. components: {
  46. Tab1,
  47. Tab2,
  48. Tab3,
  49. },
  50. // 数据
  51. data() {
  52. const that = this;
  53. return {
  54. tabIndex: 0,
  55. };
  56. },
  57. // 函数
  58. methods: {
  59. tabSelect(state) {
  60. this.tabIndex = state;
  61. },
  62. // 请求服务
  63. requestData() {},
  64. },
  65. created() {
  66. this.requestData();
  67. },
  68. mounted() {},
  69. unmounted() {},
  70. };
  71. </script>
  72. <style lang="less" scope>
  73. .health {
  74. height: 100%;
  75. padding: 10px 20px;
  76. .selections {
  77. display: flex;
  78. .item {
  79. flex: 0 0 128px;
  80. text-align: center;
  81. line-height: 33px;
  82. margin-right: 8px;
  83. color: @font-color;
  84. font-size: @fontsize-s;
  85. background: fade(@gray, 20);
  86. border: 1px solid fade(@gray, 20);
  87. &:hover,
  88. &.active {
  89. background: fade(@green, 20);
  90. border: 1px solid @green;
  91. color: @green;
  92. cursor: pointer;
  93. }
  94. }
  95. }
  96. .curHeight {
  97. height: calc(100% - 48px);
  98. }
  99. }
  100. </style>