Skip to content

Commit

Permalink
fix error onMounted and getBoundingRect
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatate committed Dec 27, 2024
1 parent 89ef23f commit e1ba4a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions components/EpisodeHeadings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const setTitlePosition = () => {
}
};
onMounted(() => {
onMounted(async () => {
await nextTick();
setTitlePosition();
window.addEventListener('resize', debounce(300, setTitlePosition));
});
Expand Down Expand Up @@ -60,11 +61,11 @@ onUnmounted(() => {
>
</nuxt-link>
<p
class="col-start-1 col-end-3 text-left text-gray-300 md:row-start-2 md:col-start-2"
class="col-start-1 col-end-3 text-left text-white/80 md:row-start-2 md:col-start-2"
>
{{ props.episode.description.substring(0, 120) }}...
</p>
<time :datetime="new Date(props.episode.publicationDate)" class="col-start-1 col-end-3 mt-1 text-sm text-left text-gray-500 md:col-start-2">
<time :datetime="new Date(props.episode.publicationDate)" class="col-start-1 col-end-3 mt-1 text-sm text-left text-white/60 md:col-start-2">
{{ date }}
</time>
<div class="flex items-center justify-between col-span-2 md:pt-2">
Expand Down
3 changes: 2 additions & 1 deletion components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ const updateHeaderHeight = () => {
headerHeight.value = header.value.getBoundingClientRect().height;
};
onMounted(() => {
onMounted(async () => {
// only client side
await nextTick();
updateHeaderHeight();
// resize window
window.addEventListener('resize', debounce(300, updateHeaderHeight));
Expand Down
4 changes: 3 additions & 1 deletion components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ const links = [
>
<nuxt-link
to="/"
title="accueil"
class="px-4 pt-4 pb-2 border-b-2 border-transparent hover:border-yellowDs"
>HOME</nuxt-link
><Icon class="relative w-5 h-5 mr-1 -top-0.5" name="material-symbols:home" title="Accueil" />//</nuxt-link
>
<nuxt-link
v-for="{title, url} in links"
:key="url"
:to="url"
:title="title"
class="px-4 pt-4 pb-2 text-sm border-b-2 border-transparent sm:text-base hover:border-yellowDs"
:class="{
'router-link-active router-link-exact-active':
Expand Down

0 comments on commit e1ba4a8

Please sign in to comment.