tabIndex.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div class="p-4">
  3. <a-card :bordered="false" style="height: 100%">
  4. <a-tabs v-model:activeKey="activeKey" @change="tabChange">
  5. <a-tab-pane :key="item.key" :tab="item.label" v-for="item in compList" />
  6. </a-tabs>
  7. <component :is="currentComponent" />
  8. </a-card>
  9. </div>
  10. </template>
  11. <script lang="ts">
  12. import { defineComponent, ref, computed } from 'vue';
  13. import {
  14. BasicFunctionForm,
  15. BasicFormConAttribute,
  16. BasicFormFieldShow,
  17. BasicFormFieldTip,
  18. BasicFormRules,
  19. BasicFormDynamicsRules,
  20. BasicFormSlots,
  21. BasicFormCustomSlots,
  22. BasicFormRander,
  23. BasicFixedWidthForm,
  24. BasicFiledsLayotForm,
  25. BasicFormLayout,
  26. BasicFormBtn,
  27. BasicFormCompact,
  28. BasicFormCleanRule,
  29. BasicFormValue,
  30. BasicFormSchemas,
  31. BasicFormAdd,
  32. BasicFormFooter,
  33. BasicFormModal,
  34. BasicFormCustom,
  35. BasicFormSearch,
  36. BasicFormComponent,
  37. BasicFormCustomComponent,
  38. } from './index';
  39. export default defineComponent({
  40. name: 'document-table-demo',
  41. components: {
  42. BasicFunctionForm,
  43. BasicFormConAttribute,
  44. BasicFormFieldShow,
  45. BasicFormFieldTip,
  46. BasicFormRules,
  47. BasicFormDynamicsRules,
  48. BasicFormSlots,
  49. BasicFormCustomSlots,
  50. BasicFormRander,
  51. BasicFixedWidthForm,
  52. BasicFiledsLayotForm,
  53. BasicFormLayout,
  54. BasicFormBtn,
  55. BasicFormCompact,
  56. BasicFormCleanRule,
  57. BasicFormValue,
  58. BasicFormSchemas,
  59. BasicFormAdd,
  60. BasicFormFooter,
  61. BasicFormModal,
  62. BasicFormCustom,
  63. BasicFormSearch,
  64. BasicFormComponent,
  65. BasicFormCustomComponent,
  66. },
  67. setup() {
  68. //当前选中key
  69. const activeKey = ref('BasicFunctionForm');
  70. //组件集合
  71. const compList = ref([
  72. { key: 'BasicFunctionForm', label: '基础表单' },
  73. { key: 'BasicFormConAttribute', label: '字段控件属性' },
  74. { key: 'BasicFormComponent', label: 'Ant Design Vue自带控件' },
  75. { key: 'BasicFormCustomComponent', label: 'JEECG封装的控件' },
  76. { key: 'BasicFormFieldShow', label: '字段显示和隐藏' },
  77. { key: 'BasicFormFieldTip', label: '字段标题提示' },
  78. { key: 'BasicFormRules', label: '表单检验' },
  79. { key: 'BasicFormDynamicsRules', label: '自定义动态检验' },
  80. { key: 'BasicFormSlots', label: '字段插槽' },
  81. { key: 'BasicFormCustomSlots', label: '自定义组件(插槽)' },
  82. { key: 'BasicFormCustom', label: '自定义组件(component)' },
  83. { key: 'BasicFormRander', label: '自定义渲染' },
  84. { key: 'BasicFixedWidthForm', label: '固定label宽度' },
  85. { key: 'BasicFiledsLayotForm', label: '标题与字段布局' },
  86. { key: 'BasicFormLayout', label: '表单布局' },
  87. { key: 'BasicFormBtn', label: '操作按钮示例' },
  88. { key: 'BasicFormCompact', label: '表单紧凑' },
  89. { key: 'BasicFormCleanRule', label: '表单检验配置' },
  90. { key: 'BasicFormValue', label: '获取value值' },
  91. { key: 'BasicFormSchemas', label: '更新schemas表单配置' },
  92. { key: 'BasicFormAdd', label: '动态增减表单' },
  93. { key: 'BasicFormFooter', label: '自定义页脚' },
  94. { key: 'BasicFormModal', label: '弹出层表单' },
  95. { key: 'BasicFormSearch', label: '查询区域' },
  96. ]);
  97. //当前选中组件
  98. const currentComponent = computed(() => {
  99. return activeKey.value;
  100. });
  101. //使用component动态切换tab
  102. function tabChange(key) {
  103. activeKey.value = key;
  104. }
  105. return {
  106. activeKey,
  107. currentComponent,
  108. tabChange,
  109. compList,
  110. };
  111. },
  112. });
  113. </script>