UI模块添加数据绑定装饰器

1.添加数据基类,子类自动添加代理,数据变化自动通知
 2.支持同属性多装饰器
This commit is contained in:
gongxh
2025-08-29 15:25:10 +08:00
parent b62a4af8db
commit e48011d941
45 changed files with 1354 additions and 21 deletions

View File

@@ -0,0 +1,26 @@
/**
* @Author: Gongxh
* @Date: 2025-08-30
* @Description:
*/
import { Level } from "../../../Data/global/Level";
import { fgui, kunpo } from "../../../header";
const { uiheader, uiprop, uicom, uiclick } = kunpo._uidecorator;
const { bindMethod, bindProp } = kunpo.data;
@uicom("Data", "DataItem")
export class DataItem extends fgui.GComponent {
@uiprop
@bindProp(Level, data => data.levelid, (item: fgui.GTextField, value: number, data: Level) => {
item.text = `关卡回调\n关卡:${value}\n层数:${data.storey}`;
})
@bindProp(Level, data => data.storey, (item: fgui.GTextField, value: number, data: Level) => {
item.text = `层数回调\n关卡:${data.levelid}\n层数:${value}`;
})
private lab_level: fgui.GTextField;
public onInit(): void {
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "8eacd9e1-5ee5-4b18-9e66-4f7e70787268",
"files": [],
"subMetas": {},
"userData": {}
}