Ułóż w kolejności · Kurs Vue.js · Moduł 2: Składnia szablonów
Cykl życia template ref
Uporządkuj kroki użycia template ref:
Elementy do ułożenia
- onMounted: element jest dostępny
- Template: ref="inputRef" na elemencie
- Deklaracja: const inputRef = ref(null)
- Użycie: inputRef.value?.focus()
Pokaż odpowiedź
Poprawna kolejność:
- Deklaracja: const inputRef = ref(null)
- Template: ref="inputRef" na elemencie
- onMounted: element jest dostępny
- Użycie: inputRef.value?.focus()