Answer the question
In order to leave comments, you need to log in
Why does the height change?
Why does the height of the textarea change by a few pixels when it becomes active and you start typing, and how can I fix this?
mage3k.github.io/vue-autosize
<template>
<div>
<textarea v-autosize="someData">{{ someData }}</textarea>
</div>
</template>
<script>
import autosize from 'autosize'
export default {
data () {
return {
someData: 'Type shit here'
}
},
directives: {
autosize: {
bind: function(el, binding) {
var tagName = el.tagName
if (tagName == 'TEXTAREA') {
autosize(el)
}
},
componentUpdated: function(el, binding, vnode) {
var tagName = el.tagName
if (tagName == 'TEXTAREA') {
autosize.update(el)
}
},
unbind: function(el) {
autosize.destroy(el)
}
}
}
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question