baseTab.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <div class="tabs w-100% flex text-center">
  3. <div
  4. v-for="tab in tabs"
  5. :key="tab.id"
  6. class="flex-1 cursor-pointer pt-1px pb-1px"
  7. :class="{ tabs_pane_actived: id === tab.id }"
  8. @click="clickHandler(tab.id)"
  9. >
  10. <slot name="name">
  11. {{ tab.name }}
  12. </slot>
  13. </div>
  14. </div>
  15. </template>
  16. <script setup lang="ts" name="gas-pump-monitor">
  17. import { defineProps } from 'vue';
  18. defineProps<{
  19. tabs: { name: string; id: string | number }[];
  20. id: string | number;
  21. }>();
  22. const emit = defineEmits(['change', 'update:id']);
  23. function clickHandler(id) {
  24. emit('change', id);
  25. emit('update:id', id);
  26. }
  27. </script>
  28. <style lang="less" scoped>
  29. @import '@/design/theme.less';
  30. .tabs {
  31. font-weight: bold;
  32. background-color: @vent-gas-tab-bg;
  33. border-radius: 5px 5px 0 0;
  34. color: @vent-font-color;
  35. }
  36. .tabs_pane_actived {
  37. background-color: @vent-gas-tab-bg-avtived;
  38. border-radius: 5px 5px 0 0;
  39. border-bottom: 5px solid @vent-gas-tab-border;
  40. }
  41. </style>