组件嵌套时报: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.

In a nested assembly process, reported an error:

Here are the reasons given: VUE components (templates) can have only one root, namely .vue file <template> under labels can only have one child.

Therefore, I recommend you write .vue time component, it is best to add a label (such as in the <Template> div ), write us at the label inside the assembly.

E.g:

. 1 <Template> 
2 <div> 
. 3 <-! Your component code -> 
. 4 </ div> 
. 5 </ Template>    

 I am here is to use this method to solve. Hoping to help you.

Guess you like

Origin www.cnblogs.com/webdom/p/12020745.html