!110 perf: 【ANTD】优化代码生成示例 demo03

Merge pull request !110 from puhui999/dev-new
This commit is contained in:
芋道源码
2025-05-19 11:56:39 +00:00
committed by Gitee
19 changed files with 365 additions and 90 deletions

View File

@@ -64,6 +64,13 @@ async function onDelete(row: Demo01ContactApi.Demo01Contact) {
// TODO @puhui999:1/** 批量删除示例联系人 */ 是不是放在 deleteIds 上面2showDeleteBatchBtn 是不是直接 disabled 哪里判断哈;
const deleteIds = ref<number[]>([]); // 待删除示例联系人 ID
const showDeleteBatchBtn = computed(() => isEmpty(deleteIds.value));
function setDeleteIds({
records,
}: {
records: Demo01ContactApi.Demo01Contact[];
}) {
deleteIds.value = records.map((item) => item.id);
}
/** 批量删除示例联系人 */
async function onDeleteBatch() {
const hideLoading = message.loading({
@@ -134,20 +141,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
} as VxeTableGridOptions<Demo01ContactApi.Demo01Contact>,
gridEvents: {
checkboxAll: ({
records,
}: {
records: Demo01ContactApi.Demo01Contact[];
}) => {
deleteIds.value = records.map((item) => item.id);
},
checkboxChange: ({
records,
}: {
records: Demo01ContactApi.Demo01Contact[];
}) => {
deleteIds.value = records.map((item) => item.id);
},
checkboxAll: setDeleteIds,
checkboxChange: setDeleteIds,
},
});
</script>