add episode hash autoscroll

This commit is contained in:
Xevion
2020-09-05 10:46:45 -05:00
parent 84715066ac
commit 39fe2dcb5c

View File

@@ -24,6 +24,7 @@
<style lang="scss">
.card-title { font-family: 'Montserrat', sans-serif; font-weight: 600; }
.deleted-scene { font-size: 0.75em; line-height: 12px; }
</style>
@@ -50,6 +51,13 @@ ${this.$route.params.season}/${this.$route.params.episode}/`;
axios.get(path)
.then((res) => {
this.episode = res.data;
// Scroll
if (this.$route.hash) {
this.$nextTick(() => {
const section = document.getElementById(this.$route.hash.substring(1));
this.$scrollTo(section, 750, { easing: 'ease-in' });
});
}
})
.catch((error) => {
// eslint-disable-next-line no-console
@@ -63,8 +71,6 @@ ${this.$route.params.season}/${this.$route.params.episode}/`;
watch: {
$route() {
this.getEpisode();
console.log(this.$route.params.hash);
this.$scrollTo(`${this.$route.hash}`, 500, { easing: 'ease-in-out' });
},
},
};