Skip to content

Commit f599c0f

Browse files
author
liyuan-meng
committed
🐛[CTable]修改文本超长的计算逻辑
1 parent f59ca7c commit f599c0f

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/components/c-table/columnTpl/link.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function LinkTpl({ value, row, linkKey, link, onClick, line = 1 }
1111

1212
useEffect(() => {
1313
if (!isVoid(value)) {
14-
if (ref.current.scrollHeight > ref.current.clientHeight) {
14+
if (ref.current.scrollHeight > ref.current.clientHeight + 4) {
1515
setTooltipContent(value);
1616
}
1717
}
@@ -46,9 +46,15 @@ export default function LinkTpl({ value, row, linkKey, link, onClick, line = 1 }
4646
LinkTpl.propTypes = {
4747
value: PropTypes.string.isRequired,
4848
linkKey: PropTypes.string.isRequired,
49+
row: PropTypes.object,
4950
link: PropTypes.string,
51+
onClick: PropTypes.func,
52+
line: PropTypes.number,
5053
};
5154

5255
LinkTpl.defaultProps = {
5356
link: '',
57+
row: {},
58+
onClick: undefined,
59+
line: 1,
5460
};

src/components/c-table/columnTpl/text.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function TextTpl({ value, line = 1 }) {
1111

1212
useEffect(() => {
1313
if (!isVoid(value)) {
14-
if (ref.current.scrollHeight > ref.current.clientHeight) {
14+
if (ref.current.scrollHeight > ref.current.clientHeight + 4) {
1515
setTooltipContent(value);
1616
}
1717
}
@@ -35,6 +35,9 @@ export default function TextTpl({ value, line = 1 }) {
3535

3636
TextTpl.propTypes = {
3737
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
38+
line: PropTypes.number,
3839
};
3940

40-
TextTpl.defaultProps = {};
41+
TextTpl.defaultProps = {
42+
line: 1,
43+
};

0 commit comments

Comments
 (0)