|
1
2
|
<template>
<PageWrapper title="卡片列表示例" content="基础封装">
|
vben
authored
|
3
|
<CardList :params="params" :api="demoListApi" @get-method="getMethod" @delete="handleDel">
|
|
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<template #header>
<Button type="primary" color="error"> 按钮1 </Button>
<Button type="primary" color="success"> 按钮2 </Button>
</template>
</CardList>
</PageWrapper>
</template>
<script lang="ts" setup>
import { CardList } from '/@/components/CardList';
import { Button } from '/@/components/Button';
import { PageWrapper } from '/@/components/Page';
import { demoListApi } from '/@/api/demo/table';
import { useMessage } from '/@/hooks/web/useMessage';
|
|
17
|
|
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
const { notification } = useMessage();
// 请求api时附带参数
const params = {};
let reload = () => {};
// 获取内部fetch方法;
function getMethod(m: any) {
reload = m;
}
//删除按钮事件
function handleDel(id) {
console.log(id);
notification.success({ message: `成功删除${id}` });
reload();
}
</script>
|