Showing
3 changed files
with
53 additions
and
0 deletions
src/components/List/index.ts
0 → 100644
src/components/List/src/BasicList.vue
0 → 100644
1 | +<script lang="ts" setup> | |
2 | + import { ReloadOutlined } from '@ant-design/icons-vue'; | |
3 | + import { Button, List, Tooltip } from 'ant-design-vue'; | |
4 | + import { reactive } from 'vue'; | |
5 | + import { ref } from 'vue'; | |
6 | + | |
7 | + const listElRef = ref<Nullable<ComponentElRef>>(null); | |
8 | + | |
9 | + const pagination = reactive({}); | |
10 | + | |
11 | + const loading = ref(false); | |
12 | + | |
13 | + const dataSource = ref([]); | |
14 | + | |
15 | + const getDataSource = () => {}; | |
16 | +</script> | |
17 | + | |
18 | +<template> | |
19 | + <section class="bg-light-50 my-4 p-4 x dark:text-gray-300 dark:bg-dark-900"> | |
20 | + <List | |
21 | + ref="listElRef" | |
22 | + :dataSource="dataSource" | |
23 | + :pagination="pagination" | |
24 | + :grid="{ gutter: 16, xs: 1, sm: 1, md: 1, lg: 2, xl: 2, xxl: 3, column: 3 }" | |
25 | + :loading="loading" | |
26 | + > | |
27 | + <template #header> | |
28 | + <section class="flex justify-between gap-4 min-h-12 items-center"> | |
29 | + <div class="text-lg font-semibold"> | |
30 | + <span>任务列表</span> | |
31 | + </div> | |
32 | + <Tooltip title="刷新"> | |
33 | + <Button type="primary" @click="getDataSource"> | |
34 | + <ReloadOutlined :spin="loading" /> | |
35 | + </Button> | |
36 | + </Tooltip> | |
37 | + </section> | |
38 | + </template> | |
39 | + <template #renderItem="{ item }"> | |
40 | + <List.Item :key="item.id"> | |
41 | + <slot name="item" :item="item"></slot> | |
42 | + </List.Item> | |
43 | + </template> | |
44 | + </List> | |
45 | + </section> | |
46 | +</template> | ... | ... |