fix(table): 修复action只赋值一次的导致弹窗刷新失败的问题
This commit is contained in:
parent
dca4986781
commit
df19646a76
|
|
@ -37,7 +37,7 @@
|
|||
"release": "release-it "
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/composition-api": "^1.0.0-beta.10",
|
||||
"@vue/composition-api": "^1.0.0-beta.11",
|
||||
"ant-design-vue": "^1.6.5",
|
||||
"axios": "^0.20.0",
|
||||
"core-js": "^3.6.5",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export function useColumns(
|
|||
if (!columns) {
|
||||
return [];
|
||||
}
|
||||
let pushActionColumns = false;
|
||||
// let pushActionColumns = false;
|
||||
let pushIndexColumns = false;
|
||||
columns.forEach((item) => {
|
||||
const { key, dataIndex } = item;
|
||||
|
|
@ -45,12 +45,12 @@ export function useColumns(
|
|||
});
|
||||
}
|
||||
}
|
||||
const actionIndex = columns.findIndex((column) => column.flag === 'ACTION');
|
||||
if (actionColumn) {
|
||||
pushActionColumns = actionIndex === -1;
|
||||
} else if (actionIndex !== -1) {
|
||||
columns.splice(actionIndex, 1);
|
||||
}
|
||||
// const actionIndex = columns.findIndex((column) => column.flag === 'ACTION');
|
||||
// if (actionColumn) {
|
||||
// pushActionColumns = actionIndex === -1;
|
||||
// } else if (actionIndex !== -1) {
|
||||
// columns.splice(actionIndex, 1);
|
||||
// }
|
||||
const indIndex = columns.findIndex((column) => column.flag === 'INDEX');
|
||||
if (showIndexColumn && !isTreeTable) {
|
||||
pushIndexColumns = indIndex === -1;
|
||||
|
|
@ -84,12 +84,13 @@ export function useColumns(
|
|||
// ...indexColumnProps,
|
||||
// });
|
||||
// }
|
||||
pushActionColumns &&
|
||||
columns.push({
|
||||
fixed: 'right',
|
||||
...actionColumn,
|
||||
flag: 'ACTION',
|
||||
});
|
||||
|
||||
// pushActionColumns &&
|
||||
// columns.push({
|
||||
// fixed: 'right',
|
||||
// ...actionColumn,
|
||||
// flag: 'ACTION',
|
||||
// });
|
||||
if (pushIndexColumns) {
|
||||
const isFixedLeft = columns.some((item) => item.fixed === 'left');
|
||||
|
||||
|
|
@ -129,15 +130,23 @@ export function useColumns(
|
|||
// });
|
||||
// }
|
||||
|
||||
// if (actionColumn) {
|
||||
// const hasIndex = columns.find((column) => column.flag === 'ACTION');
|
||||
// !hasIndex &&
|
||||
// columns.push({
|
||||
// fixed: 'right',
|
||||
// ...actionColumn,
|
||||
// flag: 'ACTION',
|
||||
// });
|
||||
// }
|
||||
if (actionColumn) {
|
||||
const hasIndex = columns.findIndex((column) => column.flag === 'ACTION');
|
||||
if (hasIndex === -1) {
|
||||
columns.push({
|
||||
fixed: 'right',
|
||||
...actionColumn,
|
||||
flag: 'ACTION',
|
||||
});
|
||||
} else {
|
||||
columns[hasIndex] = {
|
||||
...columns[hasIndex],
|
||||
fixed: 'right',
|
||||
...actionColumn,
|
||||
flag: 'ACTION',
|
||||
};
|
||||
}
|
||||
}
|
||||
return columns;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2199,7 +2199,7 @@
|
|||
optionalDependencies:
|
||||
prettier "^1.18.2"
|
||||
|
||||
"@vue/composition-api@^1.0.0-beta.10":
|
||||
"@vue/composition-api@^1.0.0-beta.11":
|
||||
version "1.0.0-beta.11"
|
||||
resolved "https://registry.npmjs.org/@vue/composition-api/-/composition-api-1.0.0-beta.11.tgz#260e9d23d59078d7a6358fec53c77a9adc0cd5b5"
|
||||
integrity sha512-WHwX8e1V2NxQtFn7DsgET3QKAfA8kIm13hT4lCdGMAtxbM1dZ/lczF4wdhmkKtKrZiv657aanXV+cgGFF71krg==
|
||||
|
|
@ -6499,6 +6499,7 @@ forever-agent@~0.6.1:
|
|||
integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=
|
||||
|
||||
"fork-ts-checker-webpack-plugin-v5@npm:fork-ts-checker-webpack-plugin@^5.0.11", fork-ts-checker-webpack-plugin@^5.0.13:
|
||||
name fork-ts-checker-webpack-plugin-v5
|
||||
version "5.1.0"
|
||||
resolved "https://registry.npmjs.org/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-5.1.0.tgz#586fbee24aeea950c53bab529e32017f543e71cf"
|
||||
integrity sha512-vuKyEjSLGbhQbEr5bifXXOkr9iV73L6n72mHoHIv7okvrf7O7z6RKeplM6C6ATPsukoQivij+Ba1vcptL60Z2g==
|
||||
|
|
|
|||
Loading…
Reference in New Issue