小程序接入瀑布流
样式
padding: 20upx;
background-color: #f6f6f6;
column-count: 2;
/*分为两列 用于瀑布流*/
column-gap: 20upx;
数据处理
setDataList(newVal) {
const newList = [].concat(...Array.from(newVal.reduce((total, cur, index) => { //瀑布流处理
total[index % 2].push(cur)
return total
}, {
0: [],
1: [],
length: 2
})))
this.setData({
newList: newList
})
},
本文来自博客园,作者:imzhi,转载请注明原文链接:https://www.cnblogs.com/imzhi/p/18194225