webpage test
This commit is contained in:
parent
338b784b8b
commit
aba6717228
@ -11,7 +11,6 @@ export default class AppAbility extends UIAbility {
|
|||||||
|
|
||||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
|
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
|
||||||
ScreenUtil.getInstance().initScreenSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(): void {
|
onDestroy(): void {
|
||||||
|
@ -16,6 +16,10 @@ struct Index {
|
|||||||
customStyle: true
|
customStyle: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
aboutToAppear(): void {
|
||||||
|
ScreenUtil.getInstance().initScreenSize();
|
||||||
|
}
|
||||||
|
|
||||||
onPageShow(): void {
|
onPageShow(): void {
|
||||||
ScreenUtil.getInstance().setPreferredOrientation(window.Orientation.AUTO_ROTATION);
|
ScreenUtil.getInstance().setPreferredOrientation(window.Orientation.AUTO_ROTATION);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { WebView, ComponentConst, CommonRes, TitleBar, WebViewController } from '@devwiki/common_ui';
|
import { WebView, ComponentConst, CommonRes, TitleBar, WebViewController, ScreenUtil } from '@devwiki/common_ui';
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
export struct WebPage {
|
export struct WebPage {
|
||||||
|
|
||||||
@State viewModel: WebPageViewModel = new WebPageViewModel();
|
@State viewModel: WebPageViewModel = new WebPageViewModel();
|
||||||
|
@StorageLink(ScreenUtil.isPortraitKey)isPortrait: boolean = true;
|
||||||
private webViewController?: WebPageController;
|
private webViewController?: WebPageController;
|
||||||
|
|
||||||
aboutToAppear(): void {
|
aboutToAppear(): void {
|
||||||
@ -39,7 +40,7 @@ export struct WebPage {
|
|||||||
left: { anchor: ComponentConst.ContainerId, align: HorizontalAlign.Start }
|
left: { anchor: ComponentConst.ContainerId, align: HorizontalAlign.Start }
|
||||||
}).width('100%').id("divider")
|
}).width('100%').id("divider")
|
||||||
|
|
||||||
WebView({ webUrl: this.viewModel?.webUrl, controller: this.webViewController }).width('100%')
|
WebView({ webUrl: this.isPortrait? this.viewModel?.webUrl : "https://blog.devwiki.net", controller: this.webViewController }).width('100%')
|
||||||
.alignRules({
|
.alignRules({
|
||||||
top: { anchor: "divider", align: VerticalAlign.Bottom },
|
top: { anchor: "divider", align: VerticalAlign.Bottom },
|
||||||
left: { anchor: ComponentConst.ContainerId, align: HorizontalAlign.Start },
|
left: { anchor: ComponentConst.ContainerId, align: HorizontalAlign.Start },
|
||||||
|
@ -18,6 +18,6 @@ struct LinearLayoutPage {
|
|||||||
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
||||||
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
||||||
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
Row().width('90%').height('10%').backgroundColor("#ff4455")
|
||||||
}.height('100%').width('100%')
|
}.width('100%')
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user