Tag Archives: Vue Error compiling template

Vue Error compiling template: Component template should contain exactly one root element. If you

Error Compiling Template:
Component template should contain exactly one root element. If you are using V-if on multiple elements, use V-else-if to chain them instead.
Component template should contain exactly one root element.
Component template should contain exactly one root element. If you use V-if in multi-element templates, instead use V-else-if to link them…
Problem code:

solution: so here under the template template should contain only one label element, rather than two or even more. The correct code after modification is as follows:

<template id="cpn">
    <div>
        <p>{{cmovies}}</p>
        <h2>{{cmessage}}</h2>
    </div>
</template>