简单的 vue 应用程序不显示任何内容

Simple vue app doesn't show anything

完整代码: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
  }
})