【问题标题】:Simple vue app doesn't show anything简单的 vue 应用程序不显示任何内容
【发布时间】: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,什么也看不见

【问题讨论】:

    标签: vuejs2 vuex


    【解决方案1】:

    因为你没有在你的根组件中渲染任何东西。

    在您的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
      }
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-30
      • 1970-01-01
      • 2018-11-08
      • 2021-11-22
      • 2019-07-23
      • 1970-01-01
      • 2013-06-11
      • 2016-08-19
      相关资源
      最近更新 更多