Skip to content

Commit

Permalink
docs/collapse panel 修复首次为展开状态时,面板高度自适应问题 (#1573)
Browse files Browse the repository at this point in the history
* docs(collapse-panel): 在已经打开的面板时修改了内容导致高度改变了面板显示不完整

* docs(collapse-panel): 修复首次为展开状态时,面板高度自适应问题

---------

Co-authored-by: hxh <1047739781>
  • Loading branch information
huxinhai authored Sep 11, 2024
1 parent 72a6e80 commit 19be4c5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/collapse/collapse-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,23 @@ export default defineComponent({
const wrapRef = ref();
const headRef = ref();
const wrapperHeight = ref('');
let isToggle = true;
const updatePanelState = () => {
nextTick(() => {
if (!wrapRef.value) {
return;
}
const { height: headHeight } = headRef.value.getBoundingClientRect();
if (!isActive.value) {
isToggle = false;
wrapperHeight.value = `${headHeight}px`;
return;
}
if (isToggle) {
isToggle = false;
wrapperHeight.value = 'auto';
return;
}
setContentWrapperHeight();
});
};
Expand Down

0 comments on commit 19be4c5

Please sign in to comment.