mint-ui loadmore使用方法和注意事項

  最好按照github裏的例子ctrl+c => v 模版、jscss

mint-ui/example/pages/pull-up.vuevue

注意設置:mt-loadmore組件:auto-fill='autoFill'爲false,以防止上來無限請求
    :給mt-loadmore父組件css:overflow: scroll;防止華爲手機和蘋果模式下瀏覽器手機測試上拉無效
    :給mt-loadmore父組件css:-webkit-overflow-scrolling: touch;防止蘋果手機拖動生澀
    :給mt-loadmore父組件高度:style="{ height: wrapperHeight + 'px' }git

1 mounted() {
2   this.wrapperHeight = document.documentElement.clientHeight - this.$refs.wrapper.getBoundingClientRect().top;
3 }

上邊這個是官方方法,用來去除輕微上拉就觸發檢測機制從而加載下一頁的BUGgithub

    :不要忘記判斷加載完成所有後臺傳來的數據列表後,this.allLoaded = true;知會禁止上拉加載web

相關理解:loadBottom()是上拉加載的方法,當用戶上拉超過閥值,觸發加載就是調用這個方法。請進行相關請求操做,請求完成後調用this.$refs.loadmore.onBottomLoaded()方法通知loadmore組件加載完成,進而自動更新status瀏覽器

1 handleBottomChange(status) {
2   this.bottomStatus = status;
3 }

這個官方方法照搬就好了,用來綁定loadmore狀態到vue實例的,經過這個值來更新顯示給用戶看的狀態app

相關文章
相關標籤/搜索