vue使用lodash

安装npm

npm i lodash -Sthis

全局引入  install     通常状况下不必  看项目使用频率spa

import _ from 'lodash'
Vue.prototype._ = _

使用 prototype

this._.debounce(this.handleClick,1000,false)code

 

单个组件中使用  在须要使用的组件里单独引入用到的方法import

import isArray from "lodash/isArray";lodash

isArray([])  //true方法

相关文章
相关标签/搜索