add filter null item from array

This commit is contained in:
jiaming 2018-12-10 18:23:25 +08:00
parent 69a91f59f2
commit 6580227882
1 changed files with 9 additions and 0 deletions

View File

@ -38,10 +38,19 @@ export function multipleSum (...num) {
return sum return sum
} }
export function filterNull (arr) {
const tmpArr = []
arr.forEach(v => (v && tmpArr.push(v)))
return tmpArr
}
export default function (Vue) { export default function (Vue) {
Vue.prototype.deepClone = deepClone Vue.prototype.deepClone = deepClone
Vue.prototype.deleteArrayAllItems = deleteArrayAllItems Vue.prototype.deleteArrayAllItems = deleteArrayAllItems
Vue.prototype.debounce = debounce Vue.prototype.debounce = debounce
Vue.prototype.multipleSum = multipleSum Vue.prototype.multipleSum = multipleSum
Vue.prototype.randomExtend = randomExtend Vue.prototype.randomExtend = randomExtend
Vue.prototype.filterNull = filterNull
} }