• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

vue实现滑动到底部加载更多效果

vue 搞代码 4年前 (2022-01-08) 51次浏览 已收录 0个评论

这篇文章主要为大家详细介绍了vue实现滑动到底部加载更多效果,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

本文实例为大家分享了vue实现滑动到底部加载更多的具体代码,供大家参考,具体内容如下

思路:

如果可视区的高度域dom元素的getBoundingClientRect().bottom高度相同说明已经到了底部,可以实现加载了

template:

  <div class="content"> <div class="logo"> <div> </div><div> <span>{{server[0].companyName}}</span></div><div>  致电客服 </div></div><div class="info"> <div class="swipe">   <div class="jcc"> </div><span class="index">{{activeIndex}}/{{server[0].thUintroduceImg.split(',').length}}</span></div><div class="info1"> <p>{{server[0].thUintroduceText}}</p><span> <i>......</i> 展开</span></div></div><div class="shopping"> <h4> <span>全部商品</span></h4></div><div> <div class="listUl"> <div class="itemLIST"> <div> </div><div> <h3>{{item.pTitle}}</h3><p> <span>已售{{item.pSaleNums}}件</span><span>价格登录可见</span><span>¥{{item.uPrice}}</span></p></div></div><!-- <div style="height:100px">{{item}}</div> --></div></div><div class="isbottom"> <i class="iconfont icon-jiazai1"></i><span>加载中,请稍后</span></div><div class="isbottom"> <span>没有更多数据了</span></div></div>

script:

 

style:

  .content { .isbottom { display: flex; align-items: center; justify-content: center; padding: 15px 0; color: #999; i { font-size: 30px; animation: rotate 1s infinite; } span { color: #ccc; padding-left: 15px; } } .logo { background: #fff; padding-bottom: 15px; div { &:nth-child(1) { display: flex; justify-content: center; img { width: 60px; height: 60px; } } &:nth-child(2) { text-align: center; padding: 15px 15px; color: #609bf0; } &:nt<i>本文来源gaodai$ma#com搞$$代**码网</i>h-child(3) { display: flex; justify-content: center; align-items: center; color: #1296db; border: #1296db 1PX solid; width: 50%; margin: 0 auto; padding: 5px 0; font-size: 15px; img { width: 20px; height: 20px; margin-right: 8px; } } } } .info { background: #fff; margin-bottom: 10px; padding-bottom: 15px; .swipe { height: 300px; background: #eee; position: relative; .jcc { display: flex; justify-content: center; height: 300px; } img { // width: 100%; height: 100%; } .index { position: absolute; background: rgba(243, 244, 245, .8); padding: 5px 15px; bottom: 10px; right: 10px; border-radius: 50px; } } } .info1 { background: #fff; position: relative; padding: 15px 9px 0; height: 79px; overflow: hidden; p { line-height: 22px; text-indent: 2em; letter-spacing: 1.2px; } span { width: 75px; text-align: right; position: absolute; bottom: 0; right: 9px; color: #39c; background: #fff; i { color: #333; } } } .shopping { background: #fff; padding-top: 15px; h4 { display: flex; align-items: center; justify-content: center; padding-bottom: 10px; >img { width: 30px; height: 30px; margin-right: 10px; } span { color: #0f589e; font-weight: normal; } } img { display: block; width: 100%; height: 2px; } } .listUl { // display: flex; // flex-wrap: wrap; padding: 0 15px; top: 60px; height: calc(100% - 100px) !important; background: #fff; overflow: hidden; .itemLIST { // float: left; width: 50%; display: inline-block; padding-top: 15px; padding-bottom: 15px; &:nth-child(2n) { padding-right: 5px; } &:nth-child(2n -1) { padding-left: 5px; } img { // width: 100%; height: 100%; /* prettier-ignore */ // border: 1PX solid #eee; } div { &:first-child { overflow: hidden; height: 160px; display: flex; align-items: center; justify-content: center; } &:last-child { h3 { font-weight: normal; font-size: 16px; margin-top: 5px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } p { font-size: 14px; margin-top: 5px; display: flex; align-items: center; justify-content: space-between; // padding: 0 15px; padding-right: 10px; span { display: block; &:first-child { color: #888; } &:last-child { color: red; font-size: 16px; } } } } } } } } 

以上就是vue实现滑动到底部加载更多效果的详细内容,更多请关注gaodaima搞代码网其它相关文章!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:vue实现滑动到底部加载更多效果

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址