How to access component data from slot?
You can use scoped slots to approximate your Angular example. The child defines a slot
in its template, and as an attribute of the slot
tag, it defines data that will be available to the parent. The parent passes a template in as the slot filler. The template can refer to the data defined by the child through the scope
attribute.
var myAwesomeComponent = { template: '<div><slot myAwesomeData="Directive Message"></slot></div>'};new Vue({ el: '#app', components: { test: myAwesomeComponent }});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js"></script><div id="app"> <test> <template scope="props"> {{ props.myAwesomeData }} </template> </test></div>