5👍
You’ll probably need to use Vue.nextTick to wait for Vue to apply your invalid class everywhere it needs to be applied.
this.$nextTick(() => {
let domRect = document.querySelector('.error').getBoundingClientRect();
window.scrollTo(
domRect.left + document.documentElement.scrollLeft,
domRect.top + document.documentElement.scrollTop
);
});
1👍
Just get first elements with error position:
window.scrollTo(document.querySelector('.error').offsetTop, 0);
- [Vuejs]-Is Ionic+Vue as frontend combinable with Umbraco as backend? (Webpack frustrations)
- [Vuejs]-What is the easiest way to import Vue.js to a typescript file?
0👍
One more way 🙂
this.$nextTick(() => {
document.querySelector('.error').scrollIntoView({block: "center", behavior: "smooth"})
});
- [Vuejs]-Setting input attributes with props and <script setup>
- [Vuejs]-How to display image url in vue.js
Source:stackexchange.com