forked from DebaucheryLibrarian/traxxx
Restoring scroll position when going from home to scene to home.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
<div class="content-inner">
|
||||
<Releases
|
||||
:releases="releases"
|
||||
referer="home"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,6 +25,13 @@ async function mounted() {
|
||||
await this.fetchReleases();
|
||||
}
|
||||
|
||||
function updated() {
|
||||
if (this.from.name === 'scene' && this.from.hash === '#home') {
|
||||
const releaseTile = document.querySelector(`#scene-${this.from.params.releaseId}`);
|
||||
if (releaseTile) releaseTile.scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
components: {
|
||||
FilterBar,
|
||||
@@ -34,8 +42,13 @@ export default {
|
||||
releases: [],
|
||||
networks: [],
|
||||
pageTitle: null,
|
||||
from: null,
|
||||
};
|
||||
},
|
||||
beforeRouteEnter(to, from, next) {
|
||||
next(vm => vm.$set(vm, 'from', from));
|
||||
},
|
||||
updated,
|
||||
mounted,
|
||||
methods: {
|
||||
fetchReleases,
|
||||
|
||||
Reference in New Issue
Block a user