Files
2026-10-22 11:45:21 +08:00

17 lines
532 B
Plaintext

class CounterText: TextBlock {
value: Number
function change(self: CounterText, event: Event): Unit {
self.value = 10
}
}
class Model {
target: Block
}
counter = CounterText("共享的原生子类对象", 9)
model = Model(counter)
button = Button("把 Number 字段改成 10")
connection = button.on("click", counter.change)
page = Page()
page.title = "字段类型契约"
page.render(Column(24, 16, counter, ui.textOf(counter, "value"), button, TextBlock("GUI 和源码写入同一个受检查的字段")))