uniapp开发鸿蒙,在页面使用web-view的时候直接把原生组件给覆盖了,使用了绝对定位无效,$getAppWebview()也无效,在h5页面、ios和安卓都是可以的,跪求大佬们指点指点。。

鸿蒙上 webview 在 style 是可以加 margin 的 ,你加上看能否出来
const setWebview = debounce((windowHeight, statusbar) => {
let currentWebview = proxy.$scope.$getAppWebview(); //获取当前web-view
var wv = currentWebview.children()[0];
wv.setStyle({
//设置web-view距离顶部的距离以及自己的高度,单位为px
top: statusbar + uni.upx2px(112), //此处是距离顶部的高度
height: windowHeight - statusbar - uni.upx2px(112), //webview的高度
scalable: false, //webview的页面是否可以缩放,双指放大缩小,
});
}, 50) 请教一下$getAppWebview()是在鸿蒙上用不了吗?我的这段代码在鸿蒙上没效果
2025-06-23 17:07