vue set focus 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: focus on input field vuejs event
<input
@focus="function"
/>