## pre
當我們`Vue.use(Router)` 的時,實際上會把`new Router`出來的router掛載到根實例上,
而子組件一旦注冊到根實例上,相當于就繼承了這個根實例,也就可以通過原型鏈找到方才 new 出來的 router

順著原型鏈再網上查找就是Vue的原型

## 通過Vue原型手動添加屬性和方法
```
Vue.prototype.$custom = '這是自定義的屬性'
```
## 通過use注冊插件
我們需要定義一個對象,這個對象上有一個名為`install`的方法,將這個對象用`Vue.use`調用,Vue就會自動調用這個對象上的`install`方法
```
let obj = {
install: function (Vue, options) { //Vue即是Vue構造函數
console.log(Vue);
console.log(options);
//因為這里能拿到Vue...
//,so能干很多事
//1. 添加全局方法或屬性
//2. 添加厙指令
//3. 注入組件
//4. 添加實例方法
}
};
Vue.use(obj,{a:'1',b:'2'});
```

- 注意use插件時傳參是以payload的形式,即要傳遞兩個參數以上時是以對象的形式
- 空白目錄
- 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