<template>
	<gracePage :customHeader="false">
		<view class="container" slot="gBody">
			<swiper class="swiper" @change="change" :circular="swiper.circular">
				<swiper-item v-for="(v, k) in fetch.items"  v-if="v.data" :key="k" >
					<scroll-view scroll-y="true" scroll-x="true" class="scroll-height">
						<dream ref="dream" :index="k" :item="v" :control="control" class="item"></dream>
					</scroll-view>
				</swiper-item>
			</swiper>

		</view>
	</gracePage>
</template>
<script>
import gracePage from "@/lib/graceUI/components/gracePage.vue";
import dream from "@/pages/dream/view/dream.vue";
var graceRichText = require("@/lib/graceUI/jsTools/richText.js");
export default{
	data() {
		return {
			id : 1,
			swiper : {
				index : 0,
				circular : false,
			},
			fetch: {
				items : []
			},
			control : {}
		}
	},
	onLoad(option) {
		this.id = option.id;
		this.getData();
	},
	// 下拉刷新
	onPullDownRefresh: function() {
		this.getData();
	},
	// 重新加载
	onPullDownRefresh: function() {
		this.getData();
	},
	methods:{
		change : function(e) {
			this.swiper.index = e.detail.current;
			if (this.control) {
				var i = 0;
				for (i in this.control) {
					if (this.control[i].load) {
						if (this.swiper.index == i) {
							this.control[i].start();
						} else {
							this.control[i].stop();
						}
					}
				}
			}
		},
		view : function() {
			this.Dever.location('dream/view?id=1');
		},
		getData : function() {
			this.Dever.get(this, 'app/collection/?l=api.getContent', {id:this.id});
		}
	},
	components:{
		gracePage,dream
	}
}
</script>
<style>
.container {
  position: absolute;
  height: 100%;
  width: 100%;
  left: 0;
  top: 0;
}
.swiper {
	width: 750rpx;
	height: 100%;
}
swiper-item>view{
  height: 100%;
}
swiper-item image{
  width: 750rpx;
  height: 100%;
}
.scroll-height {
	height:100%;
}
</style>