美文网首页
关于SectionList组件实现九宫格样式

关于SectionList组件实现九宫格样式

作者: 91阿生 | 来源:发表于2018-08-20 18:32 被阅读71次

针对SectionList组件的实现九宫格样式,效果图:

效果图.png
普遍:
{
"list": [
    {
      "title" : "童声童梦",
      "loc" : 0,
      "data": [
          {"icon":"gushihui", "title":"故事汇", "type":0},
          {"icon":"huiben", "title":"绘本", "type":1},
          {"icon":"gequ", "title":"歌曲", "type":2}
      ]
    },
  ]
}
修改后的结构:
{
    "list": [
        {
          "title" : "童声童梦",
          "loc" : 0,
          "data": [
              [
                {"icon":"gushihui", "title":"故事汇", "type":0},
                {"icon":"huiben", "title":"绘本", "type":1},
                {"icon":"gequ", "title":"歌曲", "type":2}
              ]
          ]
        },
    ]
 }

**注意在data中多加了一个数组来包裹。

SectionList
代码1.png
头部
代码2.png
item
image.png image.png

利用map遍历, 获取每个 { } 对象(cell)
修改布局为 row 样式,设置超出范围 换行属性。

相关文章

网友评论

      本文标题:关于SectionList组件实现九宫格样式

      本文链接:https://www.haomeiwen.com/subject/qholiftx.html