页面代码:
<view class="header">
</view>
<view class="chat-list">
</view>
<view class="send-box">
</view>
计算公式:
const that = this;
uni.createSelectorQuery().select(".header").boundingClientRect((header) => {
uni.createSelectorQuery().select(".chat-list").boundingClientRect((chatList) => {
uni.createSelectorQuery().select(".send-box").boundingClientRect((sendBox) => {
console.log(header.height);
const windowHeight = uni.getSystemInfoSync()['windowHeight'];
const height = (windowHeight /* - header.height */ - chatList.bottom - sendBox.height);
that.chatViewHeight = height + 'px';
}).exec();
}).exec();
}).exec();
网友评论