提交 af378c99 编写于 作者: H hdx

navbar-lite: 调整 getBoundingClientRectAsync 抽取重复逻辑,适配微信滚动

上级 65c083b8
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<radio value="2"><text>web-view</text></radio> <radio value="2"><text>web-view</text></radio>
</radio-group> </radio-group>
</view> </view>
<scroll-view v-if="indexView==0" class="scroll-view" :refresher-enabled="false"> <scroll-view v-if="indexView==0" class="scroll-view" :scroll-y="true" :refresher-enabled="false">
<view class="content-item" v-for="item in 10"> <view class="content-item" v-for="item in 10">
<view class="cell-item"> <view class="cell-item">
<text class="text">内容:{{item}}</text> <text class="text">内容:{{item}}</text>
...@@ -116,15 +116,22 @@ ...@@ -116,15 +116,22 @@
// 自动化测试 // 自动化测试
setLifeCycleNum(num : number) { setLifeCycleNum(num : number) {
setLifeCycleNum(num) setLifeCycleNum(num)
}, },
async calcInputRemainHeight() {
let windowHeight = uni.getWindowInfo().windowHeight
const rect = await uni.getElementById('input')!.getBoundingClientRectAsync()
this.inputRemainHeight = windowHeight - rect.bottom ?? windowHeight
}
}, },
onReady() { onReady() {
let windowHeight = uni.getWindowInfo().windowHeight; this.calcInputRemainHeight()
this.inputRemainHeight = windowHeight - (uni.getElementById('input')?.getBoundingClientRect()?.bottom??windowHeight); // let windowHeight = uni.getWindowInfo().windowHeight;
// this.inputRemainHeight = windowHeight - (uni.getElementById('input')?.getBoundingClientRect()?.bottom??windowHeight);
}, },
onResize() { onResize() {
let windowHeight = uni.getWindowInfo().windowHeight; this.calcInputRemainHeight()
this.inputRemainHeight = windowHeight - (uni.getElementById('input')?.getBoundingClientRect()?.bottom??windowHeight); // let windowHeight = uni.getWindowInfo().windowHeight;
// this.inputRemainHeight = windowHeight - (uni.getElementById('input')?.getBoundingClientRect()?.bottom??windowHeight);
} }
} }
</script> </script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册