[bugfix] Collapse: can not expand when clientHeight equals zero (#2993)

This commit is contained in:
neverland
2019-03-19 21:39:26 +08:00
committed by GitHub
parent 7b919ce890
commit c4da311281
3 changed files with 62 additions and 8 deletions

View File

@@ -80,11 +80,16 @@ export default sfc({
return;
}
const contentHeight = `${content.clientHeight}px`;
wrapper.style.height = expanded ? 0 : contentHeight;
raf(() => {
wrapper.style.height = expanded ? contentHeight : 0;
});
const { clientHeight } = content;
if (clientHeight) {
const contentHeight = `${clientHeight}px`;
wrapper.style.height = expanded ? 0 : contentHeight;
raf(() => {
wrapper.style.height = expanded ? contentHeight : 0;
});
} else {
this.onTransitionEnd();
}
});
}
},