-1👍
In vue , mounted function is called when page or component have fully loaded . So you can try in that function like below …
Vue.config.devtools = false
Vue.config.productionTip = false
new Vue({
el: '#app',
mounted: function() {
window.scrollTo({ top:document.body.scrollHeight, behavior: 'smooth'});
}
})
#scrooll {
height: 1900px;
border: 1px solid red;
}
#scrooll h1 {
position:absolute;
top: 1800px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<div id="scrooll">
<h1>Hey I shoud be at bottom</h1>
</div>
</div>
- [Vuejs]-Cannot render Vue-js in template
- [Vuejs]-Vue v-model doesn't trigger with third party dropdowns
Source:stackexchange.com