mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-16 14:13:36 -06:00
add episode hash autoscroll
This commit is contained in:
@@ -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' });
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user