vue.js命名视图加载应用程序启动

时间:2017-02-02 13:17:50

标签: vue.js

我是vue.js的新手,在启动vue应用时无法弄清楚如何加载和渲染路线。例如(见下面的链接)如何呈现"路径的组件:' /'"当应用程序加载时目前,只有在点击链接时才会加载。

jsfiddle complete example here

const router = new VueRouter({
mode: 'history',
routes: [
  { path: '/',
    // a single route can define multiple named components
    // which will be rendered into <router-view>s with corresponding names.
    components: {
    default: Foo,
    a: Bar,
    b: Baz
    }
  },
  {
     path: '/other',
     components: {
     default: Baz,
     a: Bar,
     b: Foo
     }
  }
  ]
})

new Vue({
router,
el: '#app'
})

0 个答案:

没有答案