index.vue 979 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <PageWrapper>
  3. <a-card
  4. :bordered="false"
  5. :active-tab-key="activeKey"
  6. :tab-list="tabList"
  7. @tabChange="
  8. key => {
  9. activeKey = key;
  10. }
  11. "
  12. >
  13. <p v-for="item in tabList" :key="item.key">
  14. <Category :type="item.type" v-if="activeKey == item.key" />
  15. </p>
  16. </a-card>
  17. </PageWrapper>
  18. </template>
  19. <script lang="ts" setup>
  20. import { onMounted, ref } from 'vue';
  21. import { PageWrapper } from '/@/components/Page';
  22. import Category from '/@/views/sys/sysDict/category/index.vue';
  23. import { listDictModel } from '/@/api/common';
  24. const activeKey = ref(null);
  25. const tabList = ref([]);
  26. onMounted(async () => {
  27. const dictType = await listDictModel({ dictCode: 'sys_dict_type' });
  28. tabList.value = [
  29. {
  30. key: dictType[0].id,
  31. tab: dictType[0].label + '字典',
  32. type: dictType[0].value,
  33. },
  34. ];
  35. activeKey.value = dictType[0]['id'];
  36. });
  37. </script>