Vue出现Component template should ...
当运行vue出现错误Component template should contain exactly one root element. If you ...的时候,我们只需要将<template>标签中的代码包裹到<div>标签中即可。
报错代码
点击查看代码
<template>
<h1>Hello World</h1>
</template>
改为这样才不会报错
点击查看代码
<template>
<div class='hello'>
<h1>Hello World</h1>
</div>
</template>

浙公网安备 33010602011771号