JSFiddle - React, Tailwind, and code Playground

by James Doyle

HTML

<div id="example">
  <input v-focus>
</div>

CSS

html, body {
  background: #f6f6f6;
  height: 100vh;
  width: 100vw;
}

JavaScript

Vue.directive('focus', {
  // When the bound element is inserted into the DOM...
  inserted: function (el) {
    // Focus the element
    el.focus()
  }
})