我正在尝试在我的页面上输出Vue.js组件,我正在关注文档,但是我收到以下错误 -
[Vue warn]: Unknown custom element: <contacts> - did you register the component correctly?
这是我的代码:
require('./bootstrap');
window.Vue = require('vue');
Vue.component('contacts', require('./components/Contacts.vue'));
const app = new Vue({
el: '#app'
});
组件代码:
<template>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Contacts list</div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>
我的刀片文件:
<div class="container">
<contacts></contacts>
</div>
答案 0 :(得分:0)
道歉,我正在运行npm run watch
,这就是VueJS组件未加载的原因。