小程序上拉加载更多样式

自己写了个上拉加载更多功能。
这里把样式和部分代码放上:


    
        ¥{{item.price}}
        {{item.time}}
        
            待审核
            未通过
        
    



const app = getApp();
var loading_state = 0;
Page({
    data: {
        loading_state:0,
        pageNumber:0,
        lists:[
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:1
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:2
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:1
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:2
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:1
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:2
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:1
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:2
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:1
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:2
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:1
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:2
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:1
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:2
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:1
            },
            {
                price:"15000",
                time:"2019.12.20 15:30:20",
                type:2
            },
        ]
    },
    onLoad: function (options) {

    },
    onShow: function () {

    },
    onReachBottom(){
        //加载更多,进行页数判断
        if(loading_state==0){
            loading_state = 1;
            var pageNumber = this.data.pageNumber+1; 
            this.setData({
                loading_state,
                pageNumber,
            })
            this.loading();
        }
    },
    loading(){
        setTimeout(()=>{
            loading_state = 0;
            var lists = this.data.lists;
            lists = [...lists,...lists]
            this.setData({
                loading_state,
                lists
            })
        },1000)
    },
    clickLoadMore(){

    }
})



page {
    /* background:#fff; */
}

.content {
    background: #fff;
    padding-left: 20rpx;
    padding-right: 20rpx;
}

.one {
    height: 120rpx;
    border-bottom: 1px solid #e8e8e8;
    position: relative;
}

.one:last-child {
    border: none;
}

.one1 {
    position: absolute;
    font-size: 32rpx;
    color: #333;
    top: 24rpx;
    left: 0;
}

.one2 {
    position: absolute;
    bottom: 14rpx;
    font-size: 26rpx;
    color: #999;
}

.one3 {
    position: absolute;
    right: 0;
    font-size: 30rpx;
    color: #999;
    top: 41rpx;
}

.red {
    color: #FB3F3F;
}

.nomsg {
    font-size: 26rpx;
    color: #999999;
    text-align: center;
    padding: 50rpx 0 20rpx;
}

/*加载更多*/
.loadmore {
    height: 100rpx;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loadmore text {
    font-size: 26rpx;
    color: #999;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.icon {
    width: 26rpx;
    height: 26rpx;
    margin-right: 20rpx;
}

.active {
    animation: weuiLoading 0.6s steps(12, end) infinite;
}

@keyframes weuiLoading {
    0% {
        transform: rotate3d(0, 0, 1, 0deg);
    }
    100% {
        transform: rotate3d(0, 0, 1, 360deg);
    }
}

你可能感兴趣的:(小程序上拉加载更多样式)