對於重組組合分類數據方法
categoryArr () {
const max = 8
const arr = []
const { categorys } = this //數據源
let smallArr = [] // 新組成的數據
categorys.forEach((item,index) => {
if(smallArr.length === 0) {
arr.push(smallArr)
}
smallArr.push(item)
if(smallArr.length === max) {
smallArr = []
}
})
return arr
}