[bugfix]: textarea filed height incorrect when display none

This commit is contained in:
陈嘉涵 2017-10-11 10:11:38 +08:00
parent d4c70e824c
commit b22e6e0230

View File

@ -89,7 +89,10 @@ export default {
mounted() { mounted() {
if (this.autosize && this.type === 'textarea') { if (this.autosize && this.type === 'textarea') {
const el = this.$refs.textarea; const el = this.$refs.textarea;
el.style.height = el.scrollHeight + 'px'; const scrollHeight = el.scrollHeight;
if (scrollHeight !== 0) {
el.style.height = scrollHeight + 'px';
}
el.style.overflowY = 'hidden'; el.style.overflowY = 'hidden';
} }
}, },