Vue.js Vue路由器错误

Vue.js Vue路由器错误,vue.js,vue-router,Vue.js,Vue Router,正在尝试设置Vue路由器。不知道我做错了什么。获取错误 装载组件失败:未定义模板或渲染函数。(在根实例中找到) 我再次从React来到Vue,虽然它们非常相似,但也有一些小的不同之处,而且Vue资源还没有那么多 我正在使用Webpack模板和单文件组件。有一件事我没有完全理解,那就是文档中的这一部分 // 1. Define route components. // These can be imported from other files const Foo = { template: '&

正在尝试设置Vue路由器。不知道我做错了什么。获取错误

装载组件失败:未定义模板或渲染函数。(在根实例中找到)

我再次从React来到Vue,虽然它们非常相似,但也有一些小的不同之处,而且Vue资源还没有那么多

我正在使用Webpack模板和单文件组件。有一件事我没有完全理解,那就是文档中的这一部分

// 1. Define route components.
// These can be imported from other files
const Foo = { template: '<div>foo</div>' }
const Bar = { template: '<div>bar</div>' }
我的
index.html
如下所示

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <title>Digestible</title>
  </head>
  <body>
    <div id="app">
        <router-view></router-view>
    </div>
    <!-- built files will be auto injected -->
  </body>
</html>

易消化

假设您拥有正确的组件,您仍然需要一个小的更新

将vue路由器加载为模块系统时,应用程序应按以下方式初始化:

new Vue({
   el: '#app',
   router,
   render: h => h(App)
});

您的QuizBuilder或ResourceInfo组件是否有模板?是的,我使用了网页包模板生成器,因此我的
QuizBuilder.vue
ResourceInfo.vue
文件都有
部分。请查看这是否有助于确定。是的,我这样做了,而且实际上做了
render:h=>h('view-router')
,这似乎解决了这个问题。谢谢
new Vue({
   el: '#app',
   router,
   render: h => h(App)
});