Merge pull request #188 from chenjiahan/dev

[bugfix]: textarea filed height incorrect when display none
This commit is contained in:
neverland 2017-10-10 21:23:30 -05:00 committed by GitHub
commit 3f79b3d179

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';
} }
}, },