Skip to content

Commit 642d9cb

Browse files
committed
fix: 解决列固定阴影,偶发性不展示,滚动列才展示
1 parent 766995a commit 642d9cb

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/components/c-table/index.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,32 @@ class CTable extends Component {
265265
this.updateSelectedNodes();
266266

267267
this.column.setColumnData();
268-
268+
this.upgradePingedRight();
269269
this.setHeaderStyle();
270270
this.setFixedStyle();
271271
this.setFooterHeight();
272272
};
273273

274+
// fix: 解决列固定阴影,偶发性不展示,滚动列才展示
275+
upgradePingedRight = () => {
276+
setTimeout(() => {
277+
if (this.ref.current) {
278+
const bodyEle = this.ref.current.querySelector(
279+
`.${tablePrefixCls}-body`,
280+
);
281+
if (bodyEle) {
282+
const { scrollWidth, clientWidth, scrollLeft } = bodyEle;
283+
const rootDom = this.ref.current.querySelector(`.${tablePrefixCls}`);
284+
if (scrollLeft < scrollWidth - clientWidth) {
285+
rootDom.classList.add(`${tablePrefixCls}-ping-right`);
286+
} else {
287+
rootDom.classList.remove(`${tablePrefixCls}-ping-right`);
288+
}
289+
}
290+
}
291+
});
292+
};
293+
274294
/**
275295
* 解决表头滚动问题(rcTable bug)
276296
*/

0 commit comments

Comments
 (0)