签入版本
This commit is contained in:
@@ -136,21 +136,42 @@ class UserLogic extends BaseTenantLogic
|
||||
### 单条删除
|
||||
|
||||
```vue
|
||||
<el-popconfirm title="确认删除该记录?" @confirm="handleDelete(row.id)">
|
||||
<template #reference>
|
||||
<el-button type="danger" size="small">删除</el-button>
|
||||
<!-- 方式一:Popconfirm 气泡确认 -->
|
||||
<a-popconfirm title="确认删除该记录?" @confirm="handleDelete(record.id)">
|
||||
<template #content>
|
||||
<span>确认删除该记录?</span>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
<a-button danger size="small">删除</a-button>
|
||||
</a-popconfirm>
|
||||
|
||||
<!-- 方式二:Modal.confirm 对话框确认(项目通用做法) -->
|
||||
<a-button danger size="small" @click="handleDelete(record.id)">删除</a-button>
|
||||
|
||||
<script setup>
|
||||
import { Modal, message } from 'ant-design-vue';
|
||||
|
||||
const handleDelete = async (id) => {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除该记录吗?',
|
||||
onOk: async () => {
|
||||
await exampleDelete(id);
|
||||
message.success('删除成功');
|
||||
reloadTable();
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
```
|
||||
|
||||
### 批量删除
|
||||
|
||||
```vue
|
||||
<el-button
|
||||
type="danger"
|
||||
<a-button
|
||||
danger
|
||||
:disabled="!selectedIds.length"
|
||||
@click="handleBatchDelete"
|
||||
>
|
||||
批量删除 ({{ selectedIds.length }})
|
||||
</el-button>
|
||||
</a-button>
|
||||
```
|
||||
Reference in New Issue
Block a user