<script>
console.clear();
  
const focus = {
  mounted(el) {
    el.focus();
  },
};

export default {
  directives: { focus },
};
  
</script>

<template>
  <input v-focus />
</template>

<style>
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
  }
</style>
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.