Skip to content

Commit 72585d6

Browse files
committed
code refactor
1 parent 674b830 commit 72585d6

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

components/vc-table/src/TableCell.jsx

+19-25
Original file line numberDiff line numberDiff line change
@@ -133,31 +133,25 @@ export default {
133133
tdProps.style = { ...tdProps.style, textAlign: column.align };
134134
}
135135

136-
if (column.showOverflowTooltip) {
137-
return (
138-
<BodyCell {...tdProps} class="has-tooltip" style={{maxWidth: 0}}>
139-
<Tooltip
140-
onVisibleChange={this.handleVisibilityChange}
141-
visible={this.tooltipVisible}
142-
placement="top"
143-
title={this.tooltipContent}>
144-
<div>
145-
{indentText}
146-
{expandIcon}
147-
{text}
148-
</div>
149-
</Tooltip>
150-
</BodyCell>
151-
);
152-
} else {
153-
return (
154-
<BodyCell {...tdProps}>
155-
{indentText}
156-
{expandIcon}
157-
{text}
158-
</BodyCell>
159-
);
160-
}
136+
const cellContent = [
137+
indentText,
138+
expandIcon,
139+
text,
140+
];
161141

142+
return column.showOverflowTooltip ? (
143+
<BodyCell {...tdProps} class="has-tooltip" style={{maxWidth: 0}}>
144+
<Tooltip
145+
onVisibleChange={this.handleVisibilityChange}
146+
visible={this.tooltipVisible}
147+
title={this.tooltipContent}>
148+
<div>{cellContent}</div>
149+
</Tooltip>
150+
</BodyCell>
151+
) : (
152+
<BodyCell {...tdProps}>
153+
{cellContent}
154+
</BodyCell>
155+
);
162156
},
163157
};

0 commit comments

Comments
 (0)