<comment>
    # 组件注释
</comment>
<template>

</template>

<script>
    //import logo from '../../../static/logo.png'
    import {TabBar, Swiper, SwiperItem} from 'mand-mobile'
    import {ScrollView, ScrollViewRefresh, ScrollViewMore} from 'mand-mobile'
    export default {
        name: 'listView',
        components: {
            //Xgplayer :  () => import('../xgplayer'),
          itemImage: () => import('../components/itemImage'),
          [SwiperItem.name]: SwiperItem,
          [ScrollView.name]: ScrollView,
          [ScrollViewRefresh.name]: ScrollViewRefresh,
          [ScrollViewMore.name]: ScrollViewMore,
        },
        data() {
            return {
              itemImage: "itemImage",
              list: 99,
              //上拉加载更多
              onEndReachedTag: false,
              //下拉刷新
              onRefreshTag : false,


              images:
                [
                  {gameUrl: "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1425581591,2239095159&fm=26&gp=0.jpg"},
                  {gameUrl: "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1425581591,2239095159&fm=26&gp=0.jpg"},
                  {gameUrl: "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1425581591,2239095159&fm=26&gp=0.jpg"},
              ],
            }
        },
        //作为子组件的时候应用父组件的时候设定的变量
        props: {},
        //用来观察 方法 对象 变量 有变化 走的回调方法
        watch: {},
        //正常方法
        methods: {
          $_onEndReached() {
            console.log("加载更多",this.onEndReachedTag);
            if (this.onEndReachedTag) {
              return
            }
            this.onEndReachedTag = true
            // var sendData = {
            //   data : {
            //     id : 9527,
            //     name : "添哥"
            //   }
            // }
            // this.utils.getListDataMore(this,sendData);
            // this.isFinished = true
            // console.log("加载更多 设置了吗",this.isFinished);
            // async data

            setTimeout(() => {
              this.onEndReachedTag = false
              // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
              // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
              // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
              // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
              // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
              // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
              // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
              // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
              // this.getListDataForTypeMore();
              console.log("有什么",this.$refs);
              this.$refs.scrollView.finishLoadMore()
            }, 1000)

          },
          $_onScroll({scrollLeft, scrollTop}) {
            // console.log(`[Mand Mobile ScrollView - demo0 - onScroll] scrollLeft: ${scrollLeft}, scrollTop: ${scrollTop}`)
          },
          $_onRefresh() {
            if (this.onRefreshTag) {
              return
            }
            this.onRefreshTag = true
            // console.log("下拉刷新");
            //
            // var sendData = {
            //   data : {
            //     id : 9527,
            //     name : "添哥"
            //   }
            // }
            // this.utils.getListData(this,sendData);
            // async data
            // setTimeout(() => {
            //   // {image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"},
            //   // this.list += 5
            //   // this.images.push({image: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1566362491089&di=64570139e7da8a5fc0161575efb10794&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201502%2F20%2F20150220120527_YVcSV.thumb.700_0.jpeg"})
            //            this.$refs.scrollView.finishRefresh()
            // }, 2000)



            this.getListDataForType(this.current,function () {
              setTimeout(() => {
                this.onRefreshTag = false
                this.$refs.scrollView.finishRefresh()
              }, 2000)
            }.bind(this),function () {
              setTimeout(() => {
                this.onRefreshTag = false
                this.$refs.scrollView.finishRefresh()
              }, 2000)
            }.bind(this))
          },
        },
        //计算方法
        computed: {},
        //生命周期 渲染html之前 可以初始化数据
        created() {

        },
        //生命周期 渲染html完毕 可以dom操作
        mounted() {

        },
        //生命周期 离开这个页面
        destroyed() {

        }
    }
</script>

<style scoped>

</style>
