引入一个子组件就报错
<template> <header></header> </template>
import Header from './components/header'
export default {
...
components: { Header },
...
}按照视频上的,引入这个子组件之后就报错
ERROR Failed to compile with 1 errors 14:48:48
error in ./src/App.vue
(Emitted value instead of an instance of Error)
Error compiling template:
<header></header>
<div id="app">
<h1>{{title}}</h1> <!-- {{ }} ==> v-text="" -->
<input v-model="newItem" v-on:keyup.enter="addNew">
<ul>
<!-- v-bind:class渲染class的时候必须是对象,如果要渲染两个或者多个class,可以采用数组的形式,如:v-bind:class="[liclass1, liclass2]" -->
<li v-for="item in items" v-bind:class="{finished:item.isFinished}" v-on:click="toggleFinish(item)">{{item.label}}</li>
</ul>
</div>
- 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.
@ ./src/App.vue 10:0-364
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:3001 webpack/hot/dev-server ./src/main.js