Last active
July 6, 2018 04:30
-
-
Save reneegyllensvaan/27bb0603de15f930e4b175d0fd7d9417 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template lang="pug"> | |
textarea(ref="input" @input="changed" rows="1" style="height:1em;resize:none;" :id="id") | |
</template> | |
<script> | |
export default { | |
mounted() { | |
this.$refs.input.value = this.$options._renderChildren ? this.$options._renderChildren[0].text : '' | |
this.$refs.input.style.height = this.$refs.input.scrollHeight+'px' | |
}, | |
props: [ | |
'id', | |
], | |
methods: { | |
changed() { | |
this.$refs.input.style.height = 'auto' | |
this.$refs.input.style.height = this.$refs.input.scrollHeight+'px' | |
}, | |
}, | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment