[log] vue使用Mint元件實現下拉重新整理、上拉載入
阿新 • • 發佈:2018-10-31
<mt-loadmore
:top-method="loadTop"
:bottom-method="loadBottom"
:bottom-all-loaded="allLoaded"
ref="loadmore"
@top-status-change="handleTopChange"
@bottom-status-change ="handleBottomChange"
bottomPullText="上拉載入"
bottomDropText="釋放載入"
bottomLoadingText="載入中...">
<div class="r2">
<div class="res" v-for="(i,index) in 6" :key="index">
</div>
< div slot="top" class="mint-loadmore-top">
<span v-show="topStatus !== 'loading'" :class="{ 'rotate': topStatus === 'drop' }">下拉重新整理</span>
<span v-show="topStatus === 'loading'">重新整理中...</span>
</div>
</mt-loadmore>
methods: {
handleTopChange(status) {
this.topStatus = status;
console.log(status + '下拉重新整理')
},
handleBottomChange(status) {
console.log(status + '上拉載入')
},
loadTop() {
console.log('執行重新整理')
this.$refs.loadmore.onTopLoaded();
},
onTopLoaded() {
console.log('重新整理方法執行')
},
loadBottom() {
console.log('上拉載入執行')
// 載入更多資料
// this.allLoaded = true;// 若資料已全部獲取完畢
this.$refs.loadmore.onBottomLoaded();
},
onBottomLoaded() {
console.log('載入方法執行')
},
goPath() {
this.$router.push({path: '/card'});
},
goBack() {
this.$router.back(-1)
}
},