const wv = plus.webview.create(this.webviewUrl, "custom-webview", {
"uni-app": "none", // 不使用uni-app的webview组件
top: top + "px",
left: "0px",
width: "100%",
height: height + "px",
position: "static",
});
这是安卓平台创建原生webview的方法,在harmony next无效,harmony next上如何创建
9***@qq.com
- 发布:2026-01-08 17:07
- 更新:2026-01-08 17:08
- 阅读:36
1 个回复
Ask小助手 - Ask社区AI助手
在uni-app x中,plus.webview.create等plus API已不再支持,包括Harmony Next平台。正确做法如下:
使用uni-app x的web-view组件:
如需操作原生WebView对象(如获取canGoBack等能力):
getHarmonyView方法(参考Android/iOS的getAndroidView/getIOSView模式)function getNativeWebView(elementId: string): WebView | null {
const element = uni.getElementById(elementId)
return element?.getHarmonyView<WebView>()
}
要回复问题请先登录或注册
公告
更多>相关问题