[toc]
```
import Vue from 'vue'
import Router from 'vue-router'
import Home from './pages/home/Home.vue';
import City from './pages/city/City.vue';
import Detail from './pages/detail/Detail.vue';
Vue.use(Router);
export default new Router({
routes: [
{
path: '/'
, name: 'Home'
, component: Home
}
,{
path: '/city'
, name: 'City'
, component: City
}
,{
path: '/detail/:id'
, name: 'Detail'
, component: Detail
}
]
//每次进入页面时都初始化滚轴位置
,scrollBehavior(to,from,savedPosition){
return {x: 0, y: 0};
}
})
```
然后注入进根实例
```
new Vue({
router
, store
, render: h => h(App)
}).$mount('#app');
```
- 空白目录
- vue-cli
- runtime-only
- Vue对比React
- 组件与实例
- data-binding
- computed的set和get
- scoped
- 事件
- 自定义指令
- 插件
- keep-alive
- $nextTick与生命周期
- 路由
- Vue.use(Router)
- this.$router编程式导航
- this.$route
- new Router
- routes
- mode
- linkClass
- scrollBehavior
- query
- fallback
- base
- router-view
- router-link
- 路由守卫
- 左右切换
- 滚动
- FAQ
- vuex
- 适用
- new Vuex.Store
- state
- mutations
- getters
- actions
- strict
- plugins
- modules
- namespace
- this.$store
- commit
- dispatch
- mapXX
- eventBus
- Vue工程相关
- 引用路径的简化
- css-module
- vue-loader
- 异步加载
- 支持jsx
- 让webpack支持对vuex的热替换
- .eslintrc