使用 scroll-view 配合uni.createSelectorQuery() 以及boundingClientRect()即可实现;
<scroll-view id="scrollview" class="chat-window" scroll-y="true" :style="{height: style.contentViewHeight + 'px'}"
:scroll-with-animation="true" :scroll-top="scrollTop">
<view class="content-all">
<block v-for="(item,index) in messages" :key="index" class="m-item">
<view class="user-chat-item animated fadeIn fast u-f right" v-if="globalUser.id==item.fromUserId">
<view class="meet-name fb">{
{item.msg}}:{
{globalUser.name}}</view>
</view>
<view class="user-chat-item animated fadeIn fast u-f left" v-else>
<view class="meet-name fb">{