<template>
	<view>
		<view class="lf-p-t-20 head" v-if="tab_list.length">
			<u-tabs :list="tab_list" :is-scroll="true" :current="current" @change="tabChange"></u-tabs>
		</view>
		<swiper :style="{height: 'calc('+ windowHeight +'px - 110rpx)', width: '750rpx'}" :current="current" @change="swiperChange">
			<swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
				<scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
					1111
				</scroll-view>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				tab_list: [{
					name: '推荐',
					list: []
				},{
					name: '酒店',
					list: []
				},{
					name: '景点',
					list: []
				},{
					name: '国内游',
					list: []
				},{
					name: '国际游',
					list: []
				},{
					name: '跟团游',
					list: []
				}],
				current: 0,
				windowHeight: 0,
				isRefresher: false // scroll-view下拉刷新状态，当前默认没有触发
			}
		},
		onLoad(){
			this.windowHeight = getApp().globalData.windowHeight;
		},
		methods: {
			tabChange(){
				this.current = current;
			},
			// 滑块下标值变化
			swiperChange(event){
				this.current = event.detail.current;
				// if(event.detail.source == '') return; // 如果是被动出发，没有事件类型则不做处理
				// if(this.tab_list[event.detail.current].list.length <= 0){
				// 	this.getGoodsList(); // tab下没有数据，请求第一页
				// }
			},
			// 页面触底，加载下一页
			onScrolltolower(){
				return;
				let tab_item = this.tab_list[this.current];
				if(tab_item.isPage){
					tab_item.page = tab_item.page + 1;
					this.getGoodsList();
				}
			},
			// scroll-view 下拉刷新
			onRefresherrefresh(){
				this.isRefresher = true;
				return;
				this.getCategoryList({type: 'scrollRefresh'});
			}
		}
	}
</script>

<style>
	page{
		background-color: #F6F6F6;
	}
</style>
<style lang="scss" scoped="scoped">
	.head{
		background-color: #FFFFFF;
	}
	.com{
		width: 100%;
		height: 100%;
	}
</style>
