添加scheme 调用
This commit is contained in:
parent
84272111c7
commit
c027ac9087
@ -7,6 +7,7 @@ import { BusinessError } from '@ohos.base';
|
|||||||
import { Log } from '@devwiki/base';
|
import { Log } from '@devwiki/base';
|
||||||
import { BaseLocalStorage, ScreenUtil } from '@devwiki/base';
|
import { BaseLocalStorage, ScreenUtil } from '@devwiki/base';
|
||||||
import { HomeItem, HomeItemGroup } from '../model/Home';
|
import { HomeItem, HomeItemGroup } from '../model/Home';
|
||||||
|
import { common, Want } from '@kit.AbilityKit';
|
||||||
|
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@ -43,6 +44,13 @@ struct Index {
|
|||||||
items: [
|
items: [
|
||||||
{ name: 'AVPlayer', page: 'pages/media/AVPlayerPage' },
|
{ name: 'AVPlayer', page: 'pages/media/AVPlayerPage' },
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
//系统能力
|
||||||
|
{
|
||||||
|
name: 'System',
|
||||||
|
items: [
|
||||||
|
{name: "Scheme", page: 'pages/system/SchemePage'}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
19
app/src/main/ets/pages/system/SchemePage.ets
Normal file
19
app/src/main/ets/pages/system/SchemePage.ets
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { common, Want } from '@kit.AbilityKit';
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Entry
|
||||||
|
export struct SchemePage {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
build() {
|
||||||
|
}
|
||||||
|
|
||||||
|
openHttp() {
|
||||||
|
let context = getContext(this) as common.UIAbilityContext;
|
||||||
|
let wantInfo: Want = {
|
||||||
|
uri: 'https://devwiki.net'
|
||||||
|
}
|
||||||
|
context.startAbility(wantInfo);
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,14 @@ export struct WebPage {
|
|||||||
this.webViewController?.refresh();
|
this.webViewController?.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBackPress(): boolean | void {
|
||||||
|
if (this.webViewController?.accessBackward()) {
|
||||||
|
this.webViewController?.backward();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
RelativeContainer() {
|
RelativeContainer() {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"pages/layout/LinearLayoutPage",
|
"pages/layout/LinearLayoutPage",
|
||||||
"pages/layout/RelativeContainerPage",
|
"pages/layout/RelativeContainerPage",
|
||||||
"pages/animation/CompTransitionPage",
|
"pages/animation/CompTransitionPage",
|
||||||
"pages/media/AVPlayerPage"
|
"pages/media/AVPlayerPage",
|
||||||
|
"pages/system/SchemePage"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ export struct WebView {
|
|||||||
@Prop @Watch("onParamChanged")param: WebViewParam = new WebViewParam();
|
@Prop @Watch("onParamChanged")param: WebViewParam = new WebViewParam();
|
||||||
|
|
||||||
onParamChanged() {
|
onParamChanged() {
|
||||||
if (this.param.webUrl != this.webviewController.getUrl()) {
|
if (this.webviewController.getUrl() && this.param.webUrl != this.webviewController.getUrl()) {
|
||||||
|
let a = this.webviewController.getUrl();
|
||||||
this.controller.loadUrl(this.param.webUrl);
|
this.controller.loadUrl(this.param.webUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,6 +61,22 @@ export class WebViewController implements WebScriptCallback, WebScriptFunction,
|
|||||||
this.webviewController?.refresh();
|
this.webviewController?.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
accessBackward(): boolean {
|
||||||
|
return this.webviewController?.accessBackward() ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
backward() {
|
||||||
|
return this.webviewController?.backward();
|
||||||
|
}
|
||||||
|
|
||||||
|
accessForward(): boolean {
|
||||||
|
return this.webviewController?.accessForward() ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
forward() {
|
||||||
|
return this.webviewController?.forward();
|
||||||
|
}
|
||||||
|
|
||||||
getCurrentUrl(): string {
|
getCurrentUrl(): string {
|
||||||
return this.webviewController?.getUrl() ?? "";
|
return this.webviewController?.getUrl() ?? "";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user