#Best way to track how many of a component are currently visible.
3 messages · Page 1 of 1 (latest)
Ideally such that each component could know if it's the first, second, third on a page, etc
I came up with this but it feels pretty hacky
<script setup>
const app = useNuxtApp();
const route = useRoute().path;
if (app.route !== route) {
app.route = route;
app.sectionCount = 0;
}
app.sectionCount++;
</script>