Click in order · Vue.js course · Module 2: Template Syntax
Template Ref Syntax with onMounted
Arrange the template ref code with auto-focus:
Items to click
- inputRef.value?.focus()
- onMounted(() => {
- const inputRef = ref(null)
- })
Show the answer
Correct order:
- const inputRef = ref(null)
- onMounted(() => {
- inputRef.value?.focus()
- })