I have a component which does not have a template. I am using the render function to build the vnodes of the component. I have a spinner component in my app which I want to add to this component. Does anyone know of documentation on the process of adding a component and referencing it for the CreateElement method? I am working on an example to show here. Thanks
You can use component name or component object for CreateElement
:
var comp = { render(h) { return h('div', ['Child Component ' + (this.value || '?')]) }, props: ['value'] } new Vue({ render: h => h('div',[ h('comp', {props:{value:'1'}}), h(comp) ]), components: { comp } }).$mount('div')
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div></div>
See: https://v2.vuejs.org/v2/guide/render-function.html#createElement-Arguments
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.