vue-router2.0
vue中路由的簡單實用
1.路由的簡單配置
export default new Router({ routes: [ { path: ‘/‘, name: ‘Hello‘, component: Hello }, { path: ‘/header‘, name: ‘Header‘, component: Header } ] })
2.路由的跳轉
註意:[email protected]
<div class="list-group">
<!-- 通過傳入 `to` 屬性指定鏈接. -->
<!-- <router-link> 默認會被渲染成一個 `<a>` 標簽 -->
<router-link to="/">Go to home</router-link>
<router-link to="/header">Go to header</router-link>
<!-- 路由出口 -->
<!-- 路由匹配到的組件將渲染在這裏 -->
<router-view></router-view>
</div>
vue-router2.0