0👍
A Vue watcher allows you to listen to the component data and run whenever a particular property changes.
I recommend reading this as this does exactly what you want:
https://v2.vuejs.org/v2/guide/computed.html.
Mounted definitely is an option however, my assumption from the async/await comment by the author was that they wanted to keep track of the props changing and not only when it gets added to the DOM. If they are only to be used once, then mounted is definitely the way to go. @ehhc
- [Vuejs]-Unable to reference data() in VUEjs Typescript
- [Vuejs]-Vue/Jasmine: grabbing an element without using a ref
0👍
@DragonInTraining I’m not sure whether mounted
wouldn’t be the appropriate place for it. In that hook, the component is already fully created. So the props are set and can be used. I don’t think watchers would be good, because the props should not change later on..
I suggest using the mounted
-hook therefore: https://v2.vuejs.org/v2/guide/instance.html#Lifecycle-Diagram