docs: explain page window and scrolling example callers
This commit is contained in:
@@ -5,19 +5,23 @@
|
||||
first = Page()
|
||||
first.title = "共享计数"
|
||||
count = ui.state(0)
|
||||
// connection 保存输入订阅,textOf 另外建立值到文字的绑定;二者共用 count,但承担不同调用职责。
|
||||
increment = Button("加一")
|
||||
connection = increment.on("click", count.increment)
|
||||
first.render(Column(24,16,TextBlock("切换页面后,计数对象继续存在"),ui.textOf(count,"value"),increment))
|
||||
|
||||
// 另一页演示 Page 生命周期与快捷键;界面提示是示例文案,实际导航位于当前宿主侧栏。
|
||||
second = Page()
|
||||
// 第二页有自己的内容根,没有引用 count;切页不等于把第一页面里的对象移进第二页面。
|
||||
second.title = "另一个页面"
|
||||
second.render(Column(24,16,TextBlock("点击上方 Tab 切换;× 关闭页面"),TextBlock("Ctrl+Tab 切换,Cmd/Ctrl+W 关闭;代码可调用 first.open() 重开")))
|
||||
|
||||
// 独立内容页面仍用同一个运行时的原生类型和资源注册表。
|
||||
third = Page()
|
||||
// 三个全局 Page 引用在 close 后仍可保留页面业务身份,重新 open 会建立新的有效展示上下文。
|
||||
third.title = "窗口与布局"
|
||||
third.render(Column(24,16,TextBlock("每个 Tab 都是同一个 VM 中的 Page 对象"),RectBlock(240,80,8,"#237A45")))
|
||||
// 重新激活第一页面,原生侧栏和源查询可观察相同 active 状态。
|
||||
first.activate()
|
||||
// 当前活动页切回 first 后请求该窗口标题,命令由成功输入后的 GUI 处理,不在这里同步操作原生窗口。
|
||||
ui.window().setTitle("Endor Pages")
|
||||
|
||||
Reference in New Issue
Block a user