直接上代码
<template>
<view class="news">
<view class="" id="demo" style="background-color: #fff;">
<u-navbar title-color="#fff" :border-bottom="false" :is-back="false" :background="{ background: '#3DAC4C' }"
title="电池列表">
</u-navbar>
</view>
重点部分
<swiper class="contaner">
<swiper-item class="scrollItem">
<scroll-view scroll-y="true" :scroll-top="scrollTop" scroll-with-animation
class="scrollItem"
@scroll="scroll" @scrolltolower="onreachBottom">
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
.news {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
background-color: #fff;
}
.contaner {
flex: 1;
.scrollItem {
width: 100%;
height: 100%;
}
}
这样当scroll-view,到达底部时,会执行scrolltolower的方法,好香啊!!!!