Skip to content

Commit f6a6ba6

Browse files
authored
fix(collapse): fix calc content height failed because of height: 100% (#194)
1 parent 793876d commit f6a6ba6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/components/collapse/index.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,13 @@ export function Collapse(props: ICollapseProps) {
112112
const dom = select<HTMLElement>(
113113
`.${collapseItemClassName}[data-content='${panel.id}']`
114114
);
115-
if (dom) {
115+
const contentDom = select<HTMLElement>(
116+
`.${collapseContentClassName}[data-content='${panel.id}']`
117+
);
118+
if (dom && contentDom) {
116119
dom.style.height = `${height}px`;
117120
dom.style.top = `${top}px`;
121+
contentDom.style.height = `${height - HEADER_HEIGTH - 2}px`;
118122
}
119123
});
120124
}, [filterData]);

src/components/collapse/style.scss

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ $collapse__extra: #{$collapse}__extra;
7171

7272
&__content {
7373
border: 1px solid transparent;
74-
height: calc(100% - 2px);
7574
width: calc(100% - 3px);
7675

7776
&:focus {

0 commit comments

Comments
 (0)