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方法

相關文章
相關標籤/搜索