JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<div id="app">
<my-parent>
<my-child></my-child>
<my-child></my-child>
</my-parent>
</div>
JavaScript
const MyParent = Vue.component('my-parent', {
render:function(createElement){
var parentContent = createElement('h2',"These are the Parent's Children:")
var myChildren = this.$slots.default.map(function(child){
return createElement(
'li',
"child")
})
var content = [].concat(parentContent, myChildren)
return createElement(
'div',
{},
content
)
}
});
const MyChild = Vue.component('my-child', {
template: '<h3>I am a child</h3>'
});
new Vue ({
el: '#app',
components: {
MyParent, MyChild
}
})