vue-lodash的使用
使用方法如下:
- 在node_models文件夹下搜索(lodash)看有没有(一般下载依赖的时候自己就带了)
- 如果有就直接用,没有就下载(看官网)
- vue中的使用方法
一定按需引入***
注意:throttle回调函数别用箭头函数,可能出现上下文this
import throttle from 'lodash/throttle'
changeIndex:throttle(function(index){
this.currentIndex = index
},50)
Lodash:节流的使用方法