新增mvvm示例

This commit is contained in:
YHH
2025-07-08 20:23:19 +08:00
parent 731edf5872
commit 2925ee380d
20 changed files with 4164 additions and 1673 deletions

View File

@@ -0,0 +1,33 @@
import { ViewModel, observable, computed, command } from '@esengine/mvvm-ui-framework';
/**
* 用户配置文件视图模型
*/
export class UserProfileViewModel extends ViewModel {
public get name(): string {
return 'UserProfileViewModel';
}
@observable
avatar: string = '';
@observable
nickname: string = '';
@observable
email: string = '';
@observable
phone: string = '';
@computed(['nickname', 'email'])
get displayInfo(): string {
return `${this.nickname} (${this.email})`;
}
@command()
public updateProfile(): void {
console.log('更新用户配置文件');
}
}