[Vuejs]-How to fetch content for a component on click of a button outside this component with Vuejs?

3👍

You can pass the popSlug value as a prop to the component as explained in the documentation here. Then in the pop-modal component, you can access the value as this.popSlug and the watch will react to changes. Just make sure to don’t modify the prop value inside the component, because it is supposed to be a read-only value.

Here is a working example. The internalValue is only used to show that the watch is being called. You can use anyname directly in the template.

Leave a comment