0
0
Fork 0

Use next tick

This commit is contained in:
William Buezas 2024-03-04 10:12:55 -03:00
parent ff94d7e43d
commit 9f1abf5cde
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, onMounted } from 'vue'; import { ref, onMounted, nextTick } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@ -13,11 +13,11 @@ const supplierContactRef = ref(null);
const insertRow = () => { const insertRow = () => {
supplierContactRef.value.insert(); supplierContactRef.value.insert();
setTimeout(() => { nextTick(() => {
const inputs = document.querySelectorAll('[input-name-focusable]'); const inputs = document.querySelectorAll('[input-name-focusable]');
const lastInput = inputs[inputs.length - 1]; const lastInput = inputs[inputs.length - 1];
if (lastInput) lastInput.focus(); if (lastInput) lastInput.focus();
}, 5); });
}; };
onMounted(() => { onMounted(() => {