// packagecard/marketing/marketinginfo.js
const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        isRefreshing: false, //是否在刷新
        isLoadMore: true, //是否在加载中
        infoList: [],
        hasMore: true, //是否有更多数据了
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var _self = this
    },
    loadMore() {
        var _self = this
        if (_self.data.hasMore) {
            if (_self.data.isLoadMore) {
                return
            }
            console.log('加载更多')
            this.setData({
                isLoadMore: true
            })
            setTimeout(() => {
                for (var i = 0; i < 20; i++) {
                    var item = {}
                    item['name'] = '新添加' + (i + 1)
                    _self.data.infoList.push(item)
                }
                _self.setData({
                    infoList: _self.data.infoList,
                    isLoadMore: false
                })
            }, 10000);
        }
    },
    dorefreshList() {
        console.log('下拉刷新了')
        var _self = this
        this.setData({
            isRefreshing: true
        })
        setTimeout(() => {
            _self.setData({
                isRefreshing: false
            })
        }, 2000);
    },
    onReachBottom() {
        // this.loadMore()
    }
})