【发布时间】:2017-04-06 01:05:30
【问题描述】:
完整代码:https://github.com/kenpeter/test_vue_template
git clone https://github.com/kenpeter/test_vue_template
安装:yarn install
运行:yarn dev
访问localhost:8080,什么也看不见
【问题讨论】:
完整代码:https://github.com/kenpeter/test_vue_template
git clone https://github.com/kenpeter/test_vue_template
安装:yarn install
运行:yarn dev
访问localhost:8080,什么也看不见
【问题讨论】:
因为你没有在你的根组件中渲染任何东西。
在您的index.html 中,渲染app 组件:
<div id="app">
<app></app>
</div>
有几种方法可以做到这一点。如果不想动你的index.html,也可以修改main.js。下面的所有代码都应该可以工作:
new Vue({
el: '#app',
render: h => h(App),
components: {
App
}
})
或
new Vue({
el: '#app',
template: '<App/>',
components: {
App
}
})
【讨论】: