Skip to content

ScrollViewDemo.llua

xu.jingyu edited this page Aug 11, 2020 · 2 revisions

copy下面代码,运行试试

model(userData)

---
--- UI
ui {
    --- layout views
    ScrollView(false, true)
    .widthPercent(100)
    .height(300)
    .bgColor(Color(0xdddddd))
    .subs(
        userData.list.forEach(function(item, index)
            Label(item.name)
            .padding(10, 20, 10, 20)
            .top(10)
            .bgColor(Color(0xaaaa00))
        end)
    )
}

---
--- preview
local function preview()
    list = {}
    for i = 1, 12 do
        temp = {}
        temp.name = i .. "哈哈哈"
        list[i] = temp
    end
    userData.list = list
end
Clone this wiki locally