mint-ui loadmore组件

mint-ui 的loadmore里的事件

html的部分这些就够了,注意loadmore的父层一定要加高度和增加overflow:scroll
首先高度在mounted里获取
this.wrapperHeight = document.documentElement.clientHeight -
this.$refs.wrapper.getBoundingClientRect().top;
loading默认是false

  loadTop(){
            var self=this;
            self.getOrderlist(self,self.userid,self.token,self.o_status,'top',self.o_day);
         },
getOrderlist(self,userid,token,status,loadtype,day){
            var listdata = new FormData();
            listdata.append("page", 0);
            listdata.append("size", this.o_size);
            listdata.append("status", status);
            listdata.append("day", day);
            listdata.append("userid", userid);
            var url=global.baseURL+''
            axios.post(url,listdata,
            {headers:
                {'Authorization':'Bearer '+token}
            })
            .then(function (response) {
                var resdata=response.data;
                self.orderlist=response.data.data;
                self.getTimes(self.orderlist);
                if(loadtype=='top'){
                    setTimeout(()=>{
                            self.$refs.loadmore.onTopLoaded();
                          },1000);
                    if(resdata.code==1000){
                        self.loading=false;//这里注意刷新完一定要吧loading重新设置成false,不然下拉刷新完将无法再上拉记载
                     }
                }
            }).catch(function (error) {
            })
        },
loadBottom(){
     var self=this;
self.getOrderlistmore(self,self.userid,self.token,self.o_status,'bottom',self.o_day);
},
getOrderlistmore(self,userid,token,status,loadtype,day){
            self.page=this.page+1
            var listdata = new FormData();
            listdata.append("page", this.page);
            listdata.append("size", this.o_size);
            listdata.append("status", status);
            listdata.append("day", day);
            listdata.append("userid", userid);
            var url=global.baseURL+''
            axios.post(url,listdata,
            {headers:
                {'Authorization':'Bearer '+token}
            })
            .then(function (response) {
                var m_list=response.data.data
                for(var i=0;i

补充:我的上拉下拉是个切换卡,因为loadmore是同一个容器,所以你往上拉的时候,点击另一个tab它的内容就会定位到上一个tab拉到的位置处
在tab切换时增加滚到顶部即可
var loadme=document.getElementsByClassName('jdlist')[0];
loadm.scrollTop=0

你可能感兴趣的:(mint-ui loadmore组件)