YangYuGang
2025-03-08 8cae1dcd8d2bde01880ac4b70bdda4e61df3c7ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<template>
  <PageWrapper title="卡片列表示例" content="基础封装">
    <CardList :params="params" :api="demoListApi" @get-method="getMethod" @delete="handleDel">
      <template #header>
        <a-button type="primary" color="error"> 按钮1 </a-button>
        <a-button type="primary" color="success"> 按钮2 </a-button>
      </template>
    </CardList>
  </PageWrapper>
</template>
<script lang="ts" setup>
  import { CardList } from '@/components/CardList';
  import { PageWrapper } from '@/components/Page';
  import { demoListApi } from '@/api/demo/table';
  import { useMessage } from '@/hooks/web/useMessage';
 
  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>