vuejs auto focus input code example
Example 1: vue js focus ref
<input type="text" ref="searchbar">
<script>
export default {
mounted() {
this.$refs.searchbar.$el.focus();
}
};
</script>
Example 2: how to make auto focus textarea vuejs
<textarea ref="message"></textarea>
this.$refs.message.focus();