05309
05309
  • 发布:2018-07-15 10:03
  • 更新:2018-07-16 13:48
  • 阅读:2997

MUI嵌套循环怎么弄的

分类:MUI
mui

MUI嵌套循环怎么弄的,备注掉的地方

2018-07-15 10:03 负责人:无 分享
已邀请:
[已删除]

[已删除]

数组,定义如i++

  • 05309 (作者)

    不明白,可以写下例子么


    2018-07-16 08:31

Rudy001

Rudy001

你这拼串的方式不好,很难维护, 简单办法是使用js模版,高级点的就是各种vue之类的框架

  • 05309 (作者)

    {"pid":"1",

    "fid":"2",

    "tid":"1",

    "first":"1",

    "author":"admin",

    "authorid":"1",

    "subject":"dfsdfsd",

    "dateline":"1530409302",

    "message":"fsdfsdfsdff ",

    "useip":"127.0.0.1",

    "invisible":"0",

    "anonymous":"0",

    "usesig":"1",

    "htmlon":"0",

    "bbcodeoff":"-1",

    "smileyoff":"-1",

    "parseurloff":"0",

    "attachment":"2",

    "rate":"0",

    "ratetimes":"0",

    "status":"0",

    "tags":"",

    "comment":"0",

    "replycredit":"0",

    "position":"1",

    "imgarr":[

    "data/attachment/forum/201807/13/001127y7zwaseep31f43f4.jpg",

    "data/attachment/forum/201807/13/001127jeupyippyapjeepe.jpg"

    ]

    }


    我的json是这样的,想内嵌查询imgarr里的所有数据。


    2018-07-16 09:24

  • Rudy001

    data.imgarr 取到的是一个数组, 然后在for循环下


    2018-07-16 09:31

  • 05309 (作者)

    回复 Rudy001:不会弄这个。


    2018-07-16 09:37

  • zhouhongfa

    回复 1***@qq.com:forEach()函数 了解一下


    2018-08-09 17:38

05309

05309 (作者) - 小白

用这种for in 输出搞完好了

for (i in myObj.sites) {
x += "<h1>" + myObj.sites[i].name + "</h1>";
for (j in myObj.sites[i].info) {
x += myObj.sites[i].info[j] + "<br>";
}
}

该问题目前已经被锁定, 无法添加新回复