harmony-web (API12)
🏆简介与推荐
harmony-web 是一款基于鸿蒙 WebView 打造的功能强大且极易上手的库,它不仅轻巧灵便、灵活度极高,还提供了一系列针对鸿蒙 WebView 的问题解决方案,助力开发者轻松应对各类开发挑战。
harmony-utils 一款功能丰富且极易上手的 HarmonyOS 工具库,借助众多实用工具类,致力于助力开发者迅速构建鸿蒙应用。
harmony-dialog 一款极为简单易用的零侵入弹窗,仅需一行代码即可轻松实现,无论在何处都能够轻松弹出。
🌞下载安装
ohpm i @pura/harmony-web
OpenHarmony ohpm 环境配置等更多内容,请参考如何安装 OpenHarmony ohpm 包<br>
📚 ArkWeb 组件,参数说明
📚 ArkWebHelper,方法说明
📚示例代码
@Entry
@ComponentV2
struct Index {
private controller: webview.WebviewController = new webview.WebviewController();
@Local webUrl: string = "";
@Local options: ArkWebOptions = new ArkWebOptions();
@Local webClient: MyWebClient = new MyWebClient();
@Local jsObject: MyJsObject = new MyJsObject();
onBackPress(): boolean {
if (this.controller?.accessBackward()) {
this.controller?.backward();
return true;
}
return false;
}
aboutToAppear(): void {
let params: Params = router.getParams() as Params;
this.webUrl = params.webUrl;
}
build() {
Column() {
ArkWeb({
controller: this.controller,
src: this.webUrl,
options: this.options,
webClient: this.webClient,
arkJsObject: this.jsObject
})
}
.height('100%')
.width('100%')
}
}
复制代码
🍎沟通与交流🙏
使用过程中发现任何问题都可以提 Issue 给我们;
当然,我们也非常欢迎你给我们发 PR 。
https://gitee.com/tongyuyan/harmony-utils
https://github.com/787107497
🌏开源协议
本项目基于 Apache License 2.0 ,在拷贝和借鉴代码时,请大家务必注明出处。
评论