feat: scrolling at the top every route change

This commit is contained in:
Roberto Tonino 2020-09-24 18:44:49 +02:00
parent dace87887b
commit f5468fe1b9
3 changed files with 8 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -72,6 +72,11 @@ export default {
this.$root.$on('updateSearchLoadingState', loading => { this.$root.$on('updateSearchLoadingState', loading => {
this.loading = loading this.loading = loading
}) })
this.$router.beforeEach((to, from, next) => {
this.$refs.content.scrollTo(0, 0)
next()
})
}, },
methods: { methods: {
handleContentScroll: debounce(async function () { handleContentScroll: debounce(async function () {

View File

@ -94,6 +94,7 @@ const router = new VueRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
console.log('js before each')
let getTracklistParams = null let getTracklistParams = null
switch (to.name) { switch (to.name) {