Skip to content
Advertisement

Vue, how do I pass data to component in render method

This is the main vue component. I want to make an ajax request and pass the data using the render method to my app component, which is a standalone component in a different file. How do I pass this data and how can I retrieve it in my app component. I am learning Vue, I know how to do this with <template></template> but would like to know if it is possible to do it this way.

JavaScript

Advertisement

Answer

Pass it as a property.

JavaScript

See the documentation here.

In your App component, add appData (or whatever you want to call it) as a property.

JavaScript

Here is an example of this working.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement