Skip to content

ScrollViewDemo.ag

xu_whale edited this page Sep 7, 2020 · 1 revision

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