• 一维数组分页


    // ==========================================================================一维数组分页
    
        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);
  • 相关阅读:
    四则运算
    实验四 决策树算法及应用
    实验三 朴素贝叶斯算法及应用
    实验二 K-近邻算法及应用
    实验三 面向对象分析与设计
    实验二 结构化分析与设计
    实验一 软件开发文档与工具的安装与使用
    ATM管理系统
    流程图与活动图的区别与联系
    四则运算自动生成程序
  • 原文地址:https://www.cnblogs.com/della/p/5659797.html
Copyright © 2020-2023  润新知