vue mint-ui源码解析之loadmore组件

本文深入解析了Mint-UI库中Loadmore组件的接入、实现原理、源码分析以及总结。重点讨论了组件的布局结构、触摸事件监听、状态判断等问题,并指出其预设高度限制灵活性的不足。
摘要由CSDN通过智能技术生成

接入

  • 官方接入文档mint-ui loadmore文档
  • 接入使用Example

    • html

      <div id="app">
          <mt-loadmore :top-method="loadTop" :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" :max-distance="150"
                       @top-status-change="handleTopChange" ref="loadmore">
      
              <div slot="top" class="mint-loadmore-top">
                  <span v-show="topStatus === 'pull'" :class="{ 'rotate': topStatus === 'drop' }"></span>
                  <span v-show="topStatus === 'loading'">Loading...</span>
                  <span v-show="topStatus === 'drop'">释放更新</span>
              </div>
      
              <ul class="scroll-wrapper">
                  <li v-for="item in list" @click="itemClick(item)">{
            { item }}</li>
              </ul>
      
          </mt-loadmore>
      </div>
    • css

      <link rel="stylesheet" href="https://unpkg.com/mint-ui/lib/style.css">
      *{
          margin: 0;
          padding: 0;
      }
      html, body{
          height: 100%;
      }
      
      #app{
      
          height: 100%;
          overflow: scroll;
      }
      .scroll-wrapper{
          margin: 0;
          padding: 0;
          list-style: none;
      
      }
      .scroll-wrapper li{
          line-height: 120px;
          font-size: 60px;
          text-align: center;
      }
    • js
      <!-- 先引入 Vue -->
      <script src="https://unpkg.com/vue/dist/vue.js"></script>
      <!-- 引入组件库 -->
      <script src="https://unpkg.com/mint-ui/lib/index.js"></script>
      <script>
          
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值