1.在获取到城市列表(list)的组件中使用computed
computed: {
renderList: function () {
//确定列数
let col = Math.ceil(this.list.length / 12)
let result = []
//分三列数据
for ( var i = 0; i < col; i ++) {
let data = this.list.slice(i * 12, i * 12 + 12)
result.push(data)
}
return result
}
}