Reputation: 69
Could someone let me know what is the various ways of using slots in Vue.js until now I think slots could be used to pass data from child component to parent component to render HTML content? could slots be used to call the parent component methods?
Upvotes: 0
Views: 52
Reputation: 223
Slots in Vue.js allow us to receive HTML content, witch also may be using Vue feature, from outside of the component. Basically just like props, but where props are for data, which component needs, slots are meant to be used for HTML code, for the template code components needs.
Upvotes: 1
Reputation: 5048
The short answer to your question is yes, slots exist in the parent scope and can expose data, functions and some other stuff from the child scope to the parent scope. As well as utilize anything within the parent scope.
Upvotes: 1