vue3-components-plus 3.0.17 → 3.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -45,6 +45,30 @@
|
|
|
45
45
|
<template #department="{ row }">
|
|
46
46
|
<el-tag effect="plain">{{ getDepartmentText(row.department) }}</el-tag>
|
|
47
47
|
</template>
|
|
48
|
+
|
|
49
|
+
<!-- 自定义删除按钮(使用 el-popconfirm) -->
|
|
50
|
+
<template #delete-action="{ row, $index }">
|
|
51
|
+
<el-popconfirm
|
|
52
|
+
title="确定要删除吗?"
|
|
53
|
+
:description="`确定要删除用户吗?`"
|
|
54
|
+
confirm-button-text="确定"
|
|
55
|
+
cancel-button-text="取消"
|
|
56
|
+
@confirm="handleDelete(row)"
|
|
57
|
+
>
|
|
58
|
+
<template #reference>
|
|
59
|
+
<el-button
|
|
60
|
+
type="danger"
|
|
61
|
+
size="small"
|
|
62
|
+
link
|
|
63
|
+
:icon="Delete"
|
|
64
|
+
:disabled="row.status === 0"
|
|
65
|
+
class="is-disabled-custom"
|
|
66
|
+
>
|
|
67
|
+
删除
|
|
68
|
+
</el-button>
|
|
69
|
+
</template>
|
|
70
|
+
</el-popconfirm>
|
|
71
|
+
</template>
|
|
48
72
|
</NsTableContainer>
|
|
49
73
|
<!-- 选择操作区域 -->
|
|
50
74
|
<div class="selection-actions">
|
|
@@ -60,7 +84,7 @@
|
|
|
60
84
|
|
|
61
85
|
<script setup lang="ts">
|
|
62
86
|
import { Delete, Edit, View } from '@element-plus/icons-vue'
|
|
63
|
-
import { ElDatePicker, ElInput, ElMessage, ElMessageBox, ElSelect, ElSwitch } from 'element-plus'
|
|
87
|
+
import { ElDatePicker, ElInput, ElMessage, ElMessageBox, ElPopconfirm, ElSelect, ElSwitch } from 'element-plus'
|
|
64
88
|
import { onMounted, ref } from 'vue'
|
|
65
89
|
import { fetchDepartmentOptions, fetchStatusOptions, filterUsers, mockUsers } from './mockData.js'
|
|
66
90
|
|
|
@@ -328,7 +352,7 @@ const columns = ref([
|
|
|
328
352
|
icon: Delete,
|
|
329
353
|
show: true,
|
|
330
354
|
disabled: (row) => row.status === 0, // 业务时不展示
|
|
331
|
-
|
|
355
|
+
slot: 'delete-action', // 使用插槽自定义删除按钮
|
|
332
356
|
},
|
|
333
357
|
],
|
|
334
358
|
},
|
|
@@ -490,15 +514,9 @@ const handleEdit = (row) => {
|
|
|
490
514
|
|
|
491
515
|
// 删除
|
|
492
516
|
const handleDelete = (row) => {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
type: 'warning',
|
|
497
|
-
}).then(() => {
|
|
498
|
-
// 模拟删除
|
|
499
|
-
ElMessage.success('删除成功')
|
|
500
|
-
loadData()
|
|
501
|
-
})
|
|
517
|
+
// 模拟删除
|
|
518
|
+
ElMessage.success(`删除用户 "${row.username}" 成功`)
|
|
519
|
+
loadData()
|
|
502
520
|
}
|
|
503
521
|
|
|
504
522
|
// ==================== 生命周期 ====================
|