mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-11-29 22:12:11 +08:00
feat(form): table操作列支持配置固定在左边还是右边
This commit is contained in:
parent
bf6598c871
commit
fa0e10f687
@ -722,7 +722,7 @@ export interface TableConfig extends FormItem {
|
||||
dropSort?: boolean;
|
||||
/** 是否显示全屏按钮 */
|
||||
enableFullscreen?: boolean;
|
||||
fixed?: boolean;
|
||||
fixed?: boolean | 'left' | 'right';
|
||||
itemExtra?: string | FilterFunction<string>;
|
||||
titleTip?: FilterFunction<string>;
|
||||
rowKey?: string;
|
||||
|
||||
@ -101,10 +101,16 @@ export const useTableColumns = (
|
||||
});
|
||||
}
|
||||
|
||||
columns.push({
|
||||
let actionFixed: 'left' | 'right' | undefined = props.config.fixed === false ? undefined : 'left';
|
||||
|
||||
if (typeof props.config.fixed === 'string' && ['left', 'right'].includes(props.config.fixed)) {
|
||||
actionFixed = props.config.fixed;
|
||||
}
|
||||
|
||||
const actionClumn = {
|
||||
props: {
|
||||
label: '操作',
|
||||
fixed: props.config.fixed === false ? undefined : 'left',
|
||||
fixed: actionFixed,
|
||||
width: props.config.operateColWidth || 112,
|
||||
align: 'center',
|
||||
},
|
||||
@ -124,7 +130,11 @@ export const useTableColumns = (
|
||||
emit('change', v);
|
||||
},
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
if (actionFixed !== 'right') {
|
||||
columns.push(actionClumn);
|
||||
}
|
||||
|
||||
if (props.sort && props.model[modelName.value] && props.model[modelName.value].length > 1) {
|
||||
columns.push({
|
||||
@ -226,6 +236,10 @@ export const useTableColumns = (
|
||||
}
|
||||
}
|
||||
|
||||
if (actionFixed === 'right') {
|
||||
columns.push(actionClumn);
|
||||
}
|
||||
|
||||
return columns;
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user