Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<template>
<div>
<input
type="text"
placeholder="Start typing..."
ref="input"
/>
</div>
</template>
<script>
import { ref, watchEffect } from 'vue'
export default {
setup () {
const input = ref(null)
watchEffect(() => {
console.log(input.value) // => input
input.value.focus()
},
{
flush: 'post'
}
)
return {
input
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment