zoukankan      html  css  js  c++  java
  • 一维数组分页

    // ==========================================================================一维数组分页
    
        var you = [{
                "categoryId": "51f9da1731d65584ab001f15",
                "categoryName": "母婴",
                "categoryPic": "201410241058583658.png",
                "shopCount": 9
            }, {
                "categoryId": "51f9da1731d65584ab001f16",
                "categoryName": "家居",
                "categoryPic": "201410241057599841.png",
                "shopCount": 12
            }, {
                "categoryId": "51f9da1731d65584ab001f17",
                "categoryName": "美食",
                "categoryPic": "201410241058318991.png",
                "shopCount": 22
            }, {
                "categoryId": "524556e83b9c89db0607e3a6",
                "categoryName": "生活服务",
                "categoryPic": "201410241057355704.png",
                "shopCount": 4
            }, {
                "categoryId": "51f9da1731d65584ab001f17",
                "categoryName": "美食",
                "categoryPic": "201410241058318991.png",
                "shopCount": 22
            }, {
                "categoryId": "524556e83b9c89db0607e3a6",
                "categoryName": "生活服务",
                "categoryPic": "201410241057355704.png",
                "shopCount": 4
            },{
                "categoryId": "51f9da1731d65584ab001f15",
                "categoryName": "母婴",
                "categoryPic": "201410241058583658.png",
                "shopCount": 9
            }, {
                "categoryId": "51f9da1731d65584ab001f16",
                "categoryName": "家居",
                "categoryPic": "201410241057599841.png",
                "shopCount": 12
            }, {
                "categoryId": "51f9da1731d65584ab001f17",
                "categoryName": "美食",
                "categoryPic": "201410241058318991.png",
                "shopCount": 22
            }, {
                "categoryId": "524556e83b9c89db0607e3a6",
                "categoryName": "生活服务",
                "categoryPic": "201410241057355704.png",
                "shopCount": 4
            }, {
                "categoryId": "51f9da1731d65584ab001f17",
                "categoryName": "美食",
                "categoryPic": "201410241058318991.png",
                "shopCount": 22
            }, {
                "categoryId": "524556e83b9c89db0607e3a6",
                "categoryName": "生活服务",
                "categoryPic": "201410241057355704.png",
                "shopCount": 4
            }, {
                "categoryId": "524556e83b9c89db0607e3a6",
                "categoryName": "生活服务",
                "categoryPic": "201410241057355704.png",
                "shopCount": 4
            }];
        var wei = [];
        for(i = 0 ; i < you.length; i++){
            if(i%4 == 0){
                wei.push([]);
            }
            wei[wei.length-1].push(you[i])
        }
        console.log(wei);
  • 相关阅读:
    linux下shell显示-bash-4.1#不显示路径解决方法
    update chnroute
    An error "Host key verification failed" when you connect to other computer by OSX SSH
    使用dig查询dns解析
    DNS被污染后
    TunnelBroker for EdgeRouter 后记
    mdadm详细使用手册
    关于尼康黄的原因
    Panda3d code in github
    Python实例浅谈之三Python与C/C++相互调用
  • 原文地址:https://www.cnblogs.com/della/p/5659797.html
Copyright © 2011-2022 走看看