Skip to content

How to make useData() reactive with page change? #4879

Closed Answered by brc-dd
Zezombye asked this question in Q&A
Discussion options

You must be logged in to vote

Use computed (https://vuejs.org/guide/essentials/computed.html)

Something like this might work:

const { page } = useData()
const currentPagePath = computed(() => page.value.relativePath.replace('.md', ''))

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by brc-dd
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4878 on August 03, 2025 04:59.