Page traduite Le contenu de cette page peut être déprécié.
La propriété scrollToTop
La propriété scrollToTop indique à Nuxt qu'il faut défiler tout en haut de la page avant de la render.
-
Type:
Boolean
(par défaut:false
)
Par défaut, Nuxt défile tout en haut lorsque l'on va sur une autre page, mais avec les routes imbriquées, Nuxt garde la position du défilement. Si l'on souhaite que Nuxt défile tout en haut lors du render des routes imbriquées, il faut passer scrollToTop
à true
:
<template>
<h1>Mon composant enfant</h1>
</template>
<script>
export default {
scrollToTop: true
}
</script>
Inversement, on peut passer scrollToTop
à false
sur les routes parent.
Si l'on souhaite écraser le comportement du défilement par défaut de Nuxt, veuillez vous référer à l'option scrollBehavior .
Editer cette page sur GitHub
Mise à jour le lun. 19 août 2024












































