Fixed #733 - Textarea does not auto resize its height when created
parent
c30e0cdb23
commit
1c5fac7abe
|
@ -9,7 +9,6 @@ export default {
|
|||
modelValue: null,
|
||||
autoResize: Boolean
|
||||
},
|
||||
cachedScrollHeight: null,
|
||||
mounted() {
|
||||
if (this.$el.offsetParent && this.autoResize) {
|
||||
this.resize();
|
||||
|
@ -22,13 +21,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
resize() {
|
||||
if (!this.cachedScrollHeight) {
|
||||
this.cachedScrollHeight = this.$el.scrollHeight;
|
||||
this.$el.style.overflow = "hidden";
|
||||
}
|
||||
|
||||
if (this.cachedScrollHeight !== this.$el.scrollHeight) {
|
||||
this.$el.style.height = ''
|
||||
this.$el.style.height = 'auto';
|
||||
this.$el.style.height = this.$el.scrollHeight + 'px';
|
||||
|
||||
if (parseFloat(this.$el.style.height) >= parseFloat(this.$el.style.maxHeight)) {
|
||||
|
@ -38,9 +31,6 @@ export default {
|
|||
else {
|
||||
this.$el.style.overflow = "hidden";
|
||||
}
|
||||
|
||||
this.cachedScrollHeight = this.$el.scrollHeight;
|
||||
}
|
||||
},
|
||||
onInput(event) {
|
||||
if (this.autoResize) {
|
||||
|
|
Loading…
Reference in New Issue