@@ -7,16 +7,16 @@
|
||||
<script setup lang="ts">
|
||||
import { watch, useTemplateRef } from 'vue'
|
||||
|
||||
const props = defineProps<{ isActive: boolean }>()
|
||||
const props = defineProps<{ isActive: boolean; isNextActiveSection: boolean }>()
|
||||
|
||||
const sectionRef = useTemplateRef('section')
|
||||
|
||||
// плавная прокрутка при активации секции
|
||||
watch(
|
||||
() => props.isActive,
|
||||
(isActive) => {
|
||||
if (isActive) {
|
||||
sectionRef.value?.querySelector('input')?.focus()
|
||||
() => props.isNextActiveSection,
|
||||
(isNextActiveSection) => {
|
||||
if (isNextActiveSection) {
|
||||
sectionRef.value?.querySelector('input[type="text"]')?.focus()
|
||||
sectionRef.value?.scrollIntoView({ behavior: 'smooth' })
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user