DefaultWebPage.ets
730 Bytes
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
import router from '@ohos.router';
import { Action } from 'wdBean';
import { Logger } from 'wdKit';
import { WdWebComponent } from 'wdWebComponent';
const TAG = 'DefaultWebPage';
@Entry
@Component
struct DefaultWebPage {
private url?: string;
@State reload: number = 0;
aboutToAppear() {
let action: Action = router.getParams() as Action
if (action) {
this.url = action.params?.url
}
}
onPageShow() {
Logger.info(TAG, `DefaultWebPage# onPageShow:::refresh`);
this.reload = ++this.reload
}
onPageHide() {
this.reload = 0
}
build() {
Column() {
WdWebComponent({
webUrl: this.url,
backVisibility: false,
reload: this.reload
})
}
}
}