美文网首页
UniApp开发--动态计算控价高度

UniApp开发--动态计算控价高度

作者: 天真的小学童 | 来源:发表于2021-01-28 17:20 被阅读0次

页面代码:

<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();

相关文章

网友评论

      本文标题:UniApp开发--动态计算控价高度

      本文链接:https://www.haomeiwen.com/subject/uwlxtltx.html