【发布时间】:2015-06-14 07:46:55
【问题描述】:
这是我的代码:
window.onload = function () {
var main = new Vue({
el: '#main',
data: {
currentActivity: 'home'
}
});
Vue.component('home', {
template: '#home-template'
});
};
这是我的模板:
<head>
<script type="text/x-template" id="home-template">
<div class="banner dark">
<div class="content">says some shit</div>
</div>
<div class="banner light">
<div class="content">says some other shit</div>
</div>
</script>
</head>
当我加载页面时,我收到以下警告:
[Vue warn]: Failed to resolve component: home
这个错误:
Uncaught TypeError: Cannot read property '_refID' of undefined
我做错了什么?
【问题讨论】:
-
你能设置一个 jsfiddle,你的代码看起来一切正常吗?
标签: javascript vue.js