TableList.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <section class="section">
  3. <div class="title">{{ title }}</div>
  4. <Table
  5. class="table"
  6. size="small"
  7. :columns="columns"
  8. :data-source="data"
  9. :pagination="{
  10. hideOnSinglePage: true,
  11. current: currentPage,
  12. pageSize: 7,
  13. onChange: (page) => (currentPage = page),
  14. }"
  15. >
  16. <template #bodyCell="{ column, text }">
  17. <template v-if="column.dataIndex === 'interaction_rate'">{{ text }}%</template>
  18. </template>
  19. </Table>
  20. </section>
  21. </template>
  22. <script setup lang="ts">
  23. import { ref, watchEffect } from 'vue';
  24. import { Table } from 'ant-design-vue';
  25. const { title, columns, data } = defineProps<{
  26. title: string;
  27. columns: object[];
  28. data: object[];
  29. }>();
  30. const currentPage = ref(1);
  31. watchEffect(() => {
  32. currentPage.value = 1;
  33. });
  34. </script>
  35. <style lang="scss" scoped>
  36. .section {
  37. min-height: 432px;
  38. padding: 18px;
  39. padding-bottom: 14px;
  40. background-color: #fff;
  41. .title {
  42. font-size: 18px;
  43. font-weight: bold;
  44. }
  45. .table {
  46. width: 100%;
  47. margin-top: 12px;
  48. }
  49. }
  50. </style>