forked from verdnatura/salix-front
Use next tick
This commit is contained in:
parent
ff94d7e43d
commit
9f1abf5cde
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ref, onMounted, nextTick } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
|
@ -13,11 +13,11 @@ const supplierContactRef = ref(null);
|
|||
|
||||
const insertRow = () => {
|
||||
supplierContactRef.value.insert();
|
||||
setTimeout(() => {
|
||||
nextTick(() => {
|
||||
const inputs = document.querySelectorAll('[input-name-focusable]');
|
||||
const lastInput = inputs[inputs.length - 1];
|
||||
if (lastInput) lastInput.focus();
|
||||
}, 5);
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
|
Loading…
Reference in New Issue