Page traduite Le contenu de cette page peut être déprécié.
Middleware anonyme
Utilisation d'un middleware anonyme pour afficher l'analyse du nombre de fois qu'un utilisateur visite une page.
Dans cet exemple :
pages/anonymous-middleware.vue
contient une fonction middleware qui utilise le store pour appeler la mutation d'incrémentation avec les résultats du store affichés sur la page.
store/analytics.js
définit pageVisits
à 0 et incrémente les visites chaque fois que la fonction d'incrémentation est appelée.
En savoir plus dans le chapitre middleware .
Loading Sandbox...
Editer cette page sur GitHub
Mise à jour le jeu. 9 février 2023

























































