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);
  • 相关阅读:
    6.7-CU微程序设计
    6.6-CU组合逻辑设计
    6.5-CU的功能
    6.4-微操作命令的分析
    6.3-时序产生器
    6.2-指令的执行
    6.1-CPU的组成与功能
    5.3-指令格式设计
    【Java循环使用 + JS循环】
    JSON转换集合,报错exepct '[', but {, pos 1, json或者syntax error, expect {, actual [, pos 0
  • 原文地址:https://www.cnblogs.com/della/p/5659797.html
Copyright © 2011-2022 走看看