diff --git a/apps/web-antd/src/components/markdown-view/markdown-view.vue b/apps/web-antd/src/components/markdown-view/markdown-view.vue
index 81ddaf14f..373957a69 100644
--- a/apps/web-antd/src/components/markdown-view/markdown-view.vue
+++ b/apps/web-antd/src/components/markdown-view/markdown-view.vue
@@ -22,7 +22,7 @@ const md = new MarkdownIt({
if (lang && hljs.getLanguage(lang)) {
try {
const copyHtml = `
复制
`;
- return `${copyHtml}${hljs.highlight(lang, str, true).value}
`;
+ return `${copyHtml}${hljs.highlight(str, { language: lang, ignoreIllegals: true }).value}
`;
} catch {}
}
return ``;
diff --git a/apps/web-antd/src/components/table-action/table-action.vue b/apps/web-antd/src/components/table-action/table-action.vue
index 122bc88fa..96d2f5403 100644
--- a/apps/web-antd/src/components/table-action/table-action.vue
+++ b/apps/web-antd/src/components/table-action/table-action.vue
@@ -60,39 +60,14 @@ function isIfShow(action: ActionItem): boolean {
/** 处理按钮 actions */
const getActions = computed(() => {
- return (props.actions || [])
- .filter((action: ActionItem) => isIfShow(action))
- .map((action: ActionItem) => {
- const { popConfirm } = action;
- return {
- type: action.type || 'link',
- ...action,
- ...popConfirm,
- onConfirm: popConfirm?.confirm,
- onCancel: popConfirm?.cancel,
- enable: !!popConfirm,
- };
- });
+ return (props.actions || []).filter((action: ActionItem) => isIfShow(action));
});
/** 处理下拉菜单 actions */
const getDropdownList = computed(() => {
- return (props.dropDownActions || [])
- .filter((action: ActionItem) => isIfShow(action))
- .map((action: ActionItem, index: number) => {
- const { label, popConfirm } = action;
- const processedAction = { ...action };
- delete processedAction.icon;
- return {
- ...processedAction,
- ...popConfirm,
- onConfirm: popConfirm?.confirm,
- onCancel: popConfirm?.cancel,
- text: label,
- divider:
- index < props.dropDownActions.length - 1 ? props.divider : false,
- };
- });
+ return (props.dropDownActions || []).filter((action: ActionItem) =>
+ isIfShow(action),
+ );
});
/** Space 组件的 size */
@@ -103,18 +78,27 @@ const spaceSize = computed(() => {
});
/** 获取 PopConfirm 属性 */
-function getPopConfirmProps(attrs: PopConfirm) {
- const originAttrs: any = { ...attrs };
- delete originAttrs.icon;
- if (attrs.confirm && isFunction(attrs.confirm)) {
- originAttrs.onConfirm = attrs.confirm;
- delete originAttrs.confirm;
+function getPopConfirmProps(popConfirm: PopConfirm) {
+ if (!popConfirm) return {};
+
+ const attrs: Record = {};
+
+ // 复制基本属性,排除函数
+ Object.keys(popConfirm).forEach((key) => {
+ if (key !== 'confirm' && key !== 'cancel' && key !== 'icon') {
+ attrs[key] = popConfirm[key as keyof PopConfirm];
+ }
+ });
+
+ // 单独处理事件函数
+ if (popConfirm.confirm && isFunction(popConfirm.confirm)) {
+ attrs.onConfirm = popConfirm.confirm;
}
- if (attrs.cancel && isFunction(attrs.cancel)) {
- originAttrs.onCancel = attrs.cancel;
- delete originAttrs.cancel;
+ if (popConfirm.cancel && isFunction(popConfirm.cancel)) {
+ attrs.onCancel = popConfirm.cancel;
}
- return originAttrs;
+
+ return attrs;
}
/** 获取 Button 属性 */
@@ -146,6 +130,13 @@ function handleMenuClick(e: any) {
function getActionKey(action: ActionItem, index: number) {
return `${action.label || ''}-${action.type || ''}-${index}`;
}
+
+/** 处理按钮点击 */
+function handleButtonClick(action: ActionItem) {
+ if (action.onClick && isFunction(action.onClick)) {
+ action.onClick();
+ }
+}
@@ -172,7 +163,10 @@ function getActionKey(action: ActionItem, index: number) {
-