Merge pull request #24 from CasbaL/fix/table-setting-bug

fix(Table): 基本表格设置列固定时,重复添加action列导致的样式错乱问题
This commit is contained in:
Ah jung
2021-08-10 17:11:51 +08:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -94,7 +94,7 @@ export function useColumns(propsRef: ComputedRef<BasicTableProps>) {
const { actionColumn } = unref(propsRef);
if (!actionColumn) return;
// @ts-ignore
columns.push({
!columns.find((col) => col.key === 'action') && columns.push({
...actionColumn,
});
}
@@ -129,7 +129,7 @@ export function useColumns(propsRef: ComputedRef<BasicTableProps>) {
}
//获取
function getColumns() {
function getColumns(): BasicColumn[] {
const columns = toRaw(unref(getColumnsRef));
return columns.map((item) => {
return { ...item, title: item.title, key: item.key, fixed: item.fixed || undefined };

View File

@@ -231,7 +231,7 @@
name: 'xiaoMa',
},
actionColumn: {
width: 140,
width: 220,
title: '操作',
key: 'action',
fixed: 'right',