Publish UI factory contracts and separate native options from subclass fields
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
class TaggedRect: RectBlock { tag: String }
|
||||
class TaggedColumn: Column { tag: String }
|
||||
class TaggedEvent: Event { tag: String }
|
||||
class TaggedList: ObjectList { tag: String }
|
||||
class Actions {
|
||||
rect: TaggedRect
|
||||
function recolor(self: Actions): Unit { self.rect.color = "#237A45" }
|
||||
}
|
||||
rect = TaggedRect(180, 60, "省略 radius/color 后的字段")
|
||||
event = TaggedEvent("click", "事件字段")
|
||||
items = TaggedList(rect, event, "列表成员之后的字段")
|
||||
actions = Actions(rect)
|
||||
button = Button("调用原对象方法")
|
||||
button.onClick(actions.recolor)
|
||||
root = TaggedColumn(24, 16, TextBlock("原生选项与子类字段分别检查", 2), rect, ui.textOf(rect, "tag"), ui.textOf(event, "tag"), ui.textOf(items, "tag"), button, "可变子项之后的字段")
|
||||
page = Page()
|
||||
page.title = "构造器契约"
|
||||
page.render(root)
|
||||
Reference in New Issue
Block a user