// In your main.js or equivalent entry file import { createApp } from 'vue'; import App from './App.vue'; const app = createApp(App); // Register a global custom directive called `v-autofocus` app.directive('autofocus', { // `mounted` hook: called when the bound element's parent component // and all its children are mounted to the DOM. mounted(el) { el.focus(); }, }); app.mount('#app'); // Usage in any component's template: //