-
Notifications
You must be signed in to change notification settings - Fork 207
VStackDemo.llua
xu.jingyu edited this page Aug 11, 2020
·
2 revisions
copy下面代码,运行试试
mLabel(str, bgColor) {
Label(str)
.textColor(Color(255, 255, 255, 0.8))
.padding(3, 5, 3, 5)
.bgColor(bgColor)
.fontSize(10)
}
colorLabel(str, color, size) {
Label(str)
.textColor(color)
.fontSize(size)
}
---
--- UI
ui {
--- layout views
VStack()
.mainAxis(MainAxis.START)
.widthPercent(100)
.height(100)
.bgColor(Color(220, 230, 200, 1))
.subs(
colorLabel("小龙虾饭 ", Color(20, 20, 20, 1), 14)
,
colorLabel("评分4.5 ", Color(250, 60, 100, 1), 12)
,
colorLabel("起送 ¥20", Color(120, 120, 120, 1), 12)
,
HStack()
.widthPercent(100)
.mainAxis(MainAxis.SPACE_BETWEEN)
.bgColor(Color(220, 230, 200, 1))
.subs(
mLabel("0元配送", Color(100, 100, 200, 0.8))
,
mLabel("支持自取", Color(100, 120, 200, 0.8))
,
mLabel("食无忧", Color(140, 120, 200, 0.8))
,
mLabel("津贴2元", Color(180, 150, 100, 0.8))
,
mLabel("会员专享", Color(180, 100, 100, 0.8))
,
mLabel("首单立减", Color(150, 60, 100, 0.8))
)
)
}
---
--- preview
local function preview()
end