You need to sign in or sign up before continuing.
提交 2d3140c0 编写于 作者: D DCloud_LXH

feat(harmony): getContentHeight

上级 95173816
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</view> </view>
<view class="uni-row uni-btn-v"> <view class="uni-row uni-btn-v">
<button class="uni-flex-item" type="primary" @click="nativeToWeb">原生和Web通信</button> <button class="uni-flex-item" type="primary" @click="nativeToWeb">原生和Web通信</button>
<!-- #ifdef APP-ANDROID || APP-IOS --> <!-- #ifdef APP-ANDROID || APP-IOS || APP-HARMONY -->
<button class="margin-left-5 uni-flex-item" type="primary" @click="getContentHeight">获取内容高度</button> <button class="margin-left-5 uni-flex-item" type="primary" @click="getContentHeight">获取内容高度</button>
<!-- #endif --> <!-- #endif -->
</view> </view>
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
nativeToWeb() { nativeToWeb() {
webviewElement?.evalJS("alert('hello uni-app x')"); webviewElement?.evalJS("alert('hello uni-app x')");
}, },
// #ifdef APP-ANDROID || APP-IOS // #ifdef APP-ANDROID || APP-IOS || APP-HARMONY
getContentHeight() : number { getContentHeight() : number {
const height = webviewElement?.getContentHeight() ?? 0; const height = webviewElement?.getContentHeight() ?? 0;
console.log('contentHeight', height); console.log('contentHeight', height);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册