[toc]
## hash与id
![](https://box.kancloud.cn/79d2ebb0ec0b72c6cac0f8196844d386_382x480.png)
## tween
```
npm i tween.js
```
```
import TWEEN from 'tween.js';
```
```
beforeRouterUpdate(to,from,next){
this.animate(to);
next();
}
,methods:{
animate(to){
function animateFunc(time){
requestAnimationFrame(animateFunc)
TWEEN.update(time);
}
if(to.hash){
//默认是带#,要去掉
var el = document.getElementById(to.hash.slice(1));
var doc = document.getElementByClassName('doc')[0];
if(el){
animateFunc();
new TWEEN.Tween({
number:doc.scrollTop;
}).to({
number:el.offsetTop;
},500).onUpdate(function(){
//这个this应该是new Tween的实例
doc.scrollTop = this.number.toFixed(0)
}).start()
}
}
}
,beforeRouterEnter(to,from,next){
next((vm)=>{
vm.animate(to);
})
}
}
```
- 空白目录
- 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