-
Notifications
You must be signed in to change notification settings - Fork 207
LinkDemo.llua
xu.jingyu edited this page Aug 12, 2020
·
2 revisions
copy下面代码,运行试试
--pageA.llua
mLabel(str, func) {
Label(str)
.crossSelf(CrossAxis.CENTER)
.top(20)
.padding(20, 20, 20, 20)
.bgColor(Color(200, 200, 0, 1))
.onClick(func)
}
function gotoPage(page, params)
Link.link(page,
params,
AnimType.BottomToTop, function(result, map)
print(page, tostring(result), tostring(map.info))
end)
end
function closePage(params)
Link.close(1, params)
end
---
--- UI
ui {
--- layout views
mLabel("当前A,跳转B", function()
gotoPage("B",
{ from = "A", to = "B" })
end)
}
---
--- preview
local function preview()
Link.register("B", "/Users/momo/github_mln/MLNUIDemoTest/src/.preview/preview_pageB.lua")
end
--pageB.llua
ui {
--- layout views
VStack()
.widthPercent(100)
.mainAxis(MainAxis.CENTER)
.subs(
mLabel("当前B,跳转C", function()
gotoPage("C"
, { from = "B", to = "C" })
end)
,
mLabel("关闭当前,返回上一页", function()
closePage({ info = "B_close" })
end))
}
---
--- preview
local function preview()
Link.register("C",
"/Users/momo/github_mln/MLNUIDemoTest/src/.preview/preview_pageC.lua")
end