fix: transition collapse 动画根元素无法设置内边距

This commit is contained in:
就眠儀式
2022-03-19 21:42:31 +08:00
parent 947579a059
commit fda2d11b20
4 changed files with 17 additions and 15 deletions

View File

@@ -58,7 +58,8 @@ const beforeLeave = (el: any) => {
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
el.dataset.oldOverflow = el.style.overflow;
el.style.height = el.scrollHeight + "px";
var computedStyle = getComputedStyle(el, null);
el.style.height = el.scrollHeight - parseInt(computedStyle.paddingTop) - parseInt(computedStyle.paddingBottom) + "px";
el.style.overflow = "hidden";
};