19 lines
821 B
Plaintext
19 lines
821 B
Plaintext
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)
|