feat: layout

pull/98/head^2
xingyu4j 2025-05-09 14:37:54 +08:00
parent db864a53e2
commit 372099f35e
1 changed files with 13 additions and 10 deletions

View File

@ -130,7 +130,11 @@ setupVbenVxeTable({
// add by 芋艿from https://github.com/vbenjs/vue-vben-admin/blob/main/playground/src/adapter/vxe-table.ts#L125-L255 // add by 芋艿from https://github.com/vbenjs/vue-vben-admin/blob/main/playground/src/adapter/vxe-table.ts#L125-L255
vxeUI.renderer.add('CellOperation', { vxeUI.renderer.add('CellOperation', {
renderTableDefault({ attrs, options, props }, { column, row }) { renderTableDefault({ attrs, options, props }, { column, row }) {
const defaultProps = { size: 'small', type: 'text', ...props }; const defaultProps = {
text: true,
type: 'primary',
...props,
};
let align = 'end'; let align = 'end';
switch (column.align) { switch (column.align) {
case 'center': { case 'center': {
@ -148,11 +152,11 @@ setupVbenVxeTable({
} }
const presets: Recordable<Recordable<any>> = { const presets: Recordable<Recordable<any>> = {
delete: { delete: {
danger: true, type: 'error',
text: $t('common.delete'), concent: $t('common.delete'),
}, },
edit: { edit: {
text: $t('common.edit'), concent: $t('common.edit'),
}, },
}; };
const operations: Array<Recordable<any>> = ( const operations: Array<Recordable<any>> = (
@ -164,7 +168,7 @@ setupVbenVxeTable({
? { code: opt, ...presets[opt], ...defaultProps } ? { code: opt, ...presets[opt], ...defaultProps }
: { : {
code: opt, code: opt,
text: $te(`common.${opt}`) ? $t(`common.${opt}`) : opt, concent: $te(`common.${opt}`) ? $t(`common.${opt}`) : opt,
...defaultProps, ...defaultProps,
}; };
} else { } else {
@ -203,7 +207,7 @@ setupVbenVxeTable({
h(IconifyIcon, { class: 'size-5', icon: opt.icon }), h(IconifyIcon, { class: 'size-5', icon: opt.icon }),
); );
} }
content.push(opt.text); content.push(opt.concent);
return content; return content;
}, },
}, },
@ -214,7 +218,6 @@ setupVbenVxeTable({
return h( return h(
NPopconfirm, NPopconfirm,
{ {
title: $t('ui.actionTitle.delete', [attrs?.nameTitle || '']),
...props, ...props,
...opt, ...opt,
icon: undefined, icon: undefined,
@ -226,8 +229,8 @@ setupVbenVxeTable({
}, },
}, },
{ {
default: () => renderBtn({ ...opt }, false), trigger: () => renderBtn({ ...opt }, false),
description: () => default: () =>
h( h(
'div', 'div',
{ class: 'truncate' }, { class: 'truncate' },
@ -245,7 +248,7 @@ setupVbenVxeTable({
return h( return h(
'div', 'div',
{ {
class: 'flex table-operations', class: 'flex table-operations ml-2',
style: { justifyContent: align }, style: { justifyContent: align },
}, },
btns, btns,