Index.ets
1.29 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
import { BottomNavBean } from 'wdBean';
import { BottomNavigationComponent, PageViewModel } from 'wdComponent';
import { BreakpointConstants } from 'wdConstant';
import { BreakpointSystem, Logger } from 'wdKit';
const TAG = 'Index';
@Entry
@Component
struct Index {
private breakpointSystem: BreakpointSystem = new BreakpointSystem()
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
@State bottomNavList: BottomNavBean[] = []
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
build() {
Column() {
BottomNavigationComponent({ bottomNavList: this.bottomNavList })
}
}
aboutToAppear() {
this.breakpointSystem.register()
let bottomNav = PageViewModel.getBottomNavData(getContext(this))
if (bottomNav) {
Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.length}`);
this.bottomNavList = bottomNav
}
}
aboutToDisappear() {
this.breakpointSystem.unregister()
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow() {
Logger.info(TAG, 'onPageShow');
}
onPageHide() {
Logger.info(TAG, 'onPageHide');
}
onBackPress() {
Logger.info(TAG, 'onBackPress');
}
}