Index.ets
1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { GroupDTO } from 'wdBean';
import { BreakpointConstants } from 'wdConstant';
import { BreakpointSystem, LazyDataSource, Logger } from 'wdKit';
import { PageViewModel } from '../viewmodel/PageViewModel';
import { PageComponent } from './PageComponent';
const TAG = 'Index';
@Entry
@Component
struct Index {
private breakpointSystem: BreakpointSystem = new BreakpointSystem()
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
@State groupList: LazyDataSource<GroupDTO> = new LazyDataSource();
// @Prop groupList: GroupDTO[] = [];
@State message: string = 'Hello Sight';
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
build() {
Column() {
PageComponent({ groupList: this.groupList })
}
}
aboutToAppear() {
this.breakpointSystem.register()
// Logger.info(TAG, `aboutToAppear, this.currentTabIndex1: ${this.currentNavIndex}`);
// PageViewModel.getGroupDTO();
let groupDto = PageViewModel.getGroupDTO(getContext(this))
if (groupDto) {
this.groupList.push(groupDto)
}
}
aboutToDisappear() {
this.breakpointSystem.unregister()
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow() {
Logger.info(TAG, 'onPageShow');
}
onPageHide() {
Logger.info(TAG, 'onPageHide');
}
onBackPress() {
Logger.info(TAG, 'onBackPress');
}
}