Change component data according to page

Hello,

Currently on a project in Vue JS, I’m stuck in the recovery of IDs.

Indeed, I created a component that I inserted in several pages. Except that when I want to change the data (title/image/text) the data changes on all the pages… Whereas I would like the same component but with different data depending on the pages.

Do you have a track to advise me ?


Thanks …

When sharing code, please don’t use screenshots.

The people wanting to help you can’t copy code from screenshots and therefore can’t edit it.

Instead, share the code as text and make sure to use proper Syntax Highlighting

I don’t entirely understand the issue. When you say “change the data”, are you mutating the data and this is undesirably being reflected elsewhere or are you changing views and want to display different data using the same component?

I want to change the data and use the same component !

Although I don’t quite understand your problem, from my guess, Just pass the data to the component through props on the page.

hi @Evlow
In mounted you can use router to check the path and change title, text and image accordingly.