This commit is contained in:
2025-06-17 00:00:56 +08:00
parent 843d03ac20
commit 3ad905cd59
5 changed files with 83 additions and 17 deletions

View File

@@ -0,0 +1,26 @@
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { VM } from "../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
/** 数据层对象 */
@ecs.register('FriendModel')
export class FriendModelComp extends ecs.Comp {
/** 提供 MVVM 组件使用的数据 */
private vm: any = {};
/** 显示数据添加到 MVVM 框架中监视 */
vmAdd() {
VM.add(this.vm, "FriendModel");
}
/** 显示数据从 MVVM 框架中移除 */
vmRemove() {
VM.remove("FriendModel");
}
/** 数据层组件移除时,重置所有数据为默认值 */
reset() {
for (var key in this.vm) {
delete this.vm[key];
}
}
}