CustomTabs.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <!-- 基准的列表模块,通过不同的 type 展示不同的样式 -->
  4. <div>
  5. <BaseTab :tabs="tabs" v-model:id="actived" class="mb-5px" />
  6. <CustomList :list-config="listConfig" :type="type" :style="{ height: 'calc(100% - 45px)', overflow: overflow ? 'auto' : 'none' }" />
  7. </div>
  8. </template>
  9. <script lang="ts" setup>
  10. import BaseTab from '/@/views/vent/gas/components/tab/baseTab.vue';
  11. import CustomList from '../detail/CustomList.vue';
  12. import { computed, ref } from 'vue';
  13. import { get } from 'lodash-es';
  14. const props = withDefaults(
  15. defineProps<{
  16. tabConfig: {
  17. title: string;
  18. contents: {
  19. value: string;
  20. color: string;
  21. label: string;
  22. info: string;
  23. }[];
  24. }[];
  25. type: string;
  26. overflow: boolean;
  27. }>(),
  28. {
  29. listConfig: () => [],
  30. type: 'A',
  31. }
  32. );
  33. const actived = ref(0);
  34. const tabs = computed(() => {
  35. return props.tabConfig.map((e, id) => {
  36. return { name: e.title, id };
  37. });
  38. });
  39. const listConfig = computed(() => {
  40. return get(props.tabConfig, actived.value).contents;
  41. });
  42. // defineEmits(['click']);
  43. </script>
  44. <style lang="less" scoped></style>