1.先安裝mint-ui
npm install mint-ui -S
2.引入mint-ui
import 'mint-ui/lib/style.css'
import { Loadmore } from 'mint-ui';
Vue.component(Loadmore.name, Loadmore);
3.下面是代碼:(拿著就可以直接用) 下拉刷新直接看官網(wǎng)加參數(shù)就OK
<template>
<div id="content">
<mt-loadmore :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" :auto-fill="false" ref="loadmore">
<div class="item" v-for="(item,index) in list" :key="index">
<div class="name">{{item.title}} + {{index}}</div>
</div>
</mt-loadmore>
</div>
</template>
<script>
import { Loadmore } from 'mint-ui';
import Vue from 'vue'
Vue.component(Loadmore.name, Loadmore);
var p = 1;
export default {
data(){
return{
list:[],
allLoaded:false,
}
},
methods:{
loadBottom: function(){
this.$refs.loadmore.onBottomLoaded();
this.getList();
},
getList: function(){
this.$http.get("自己的接口信息?st=0&et=0&page="+p+"&offset=條數(shù)").then(res=>{
this.list = this.list.concat(res.data.data)
console.log(this.list)
})
p += 1
}
},
mounted: function(){
this.getList();
}
}
</script>
<style scoped>
#content{
overflow: scroll;
}
.item{
}
.item .name{
height: 50px;
background-color: green;
margin-bottom: 10px;
}
</style>
mint-ui 實(shí)現(xiàn)上拉加載
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。