<template>
	<view :class="[AppTheme]" class="all_box" v-if="thflag==1">
		<!-- 中间预览区域 -->
		<view v-for="(vdc, index) in tasks" :key="index">
			<load-component ref="ldcomponent" :vdc="vdc" :uikey="vdc.component_key"
				:template="vdc.template_name || 'template1'">
			</load-component>
		</view>
	</view>
</template>
<script>
	import Vue from 'vue'
	// 组件加载主体
	import loadComponent from '@/components/ui-component-load/index.vue';
	export default {
		name: "themes1",
		props: ['primary2', 'thflag'],
		components: {
			loadComponent
		},
		data() {
			return {
				primary: this.$theme.primary,
				ifhavehead: false,
				tasks: []
			}
		},
		methods: {
			init() {
				let that = this;
				let config = that.$until.myCache(that.$cache_config_info_key);
				if (!config) {
					if (res && res.pagecfg) {
						that.pagecfg = res.pagecfg;
						that.pageinfo = res.pagecfg.page_info;
						that.tasks = res.pagecfg.datas
					}
				} else {
					that.pagecfg = config.pagecfg;
					that.pageinfo = config.pagecfg.page_info;
					that.tasks = config.pagecfg.datas
				}
				that.onload();
			},
			onload() {
				let that = this
				let slideshow = null;
				if (that.$refs.ldcomponent) {
					that.$refs.ldcomponent.forEach(item => {
						if (item.$refs.slideshow) {
							slideshow = item;
						}
					})
					if (slideshow) {
						slideshow.init();
					}
				}
			},
			toBottom(type) {
				let that = this
				let goodlist = null;
				if (that.$refs.ldcomponent) {
					that.$refs.ldcomponent.forEach(item => {
						if (item.$refs.goodlist) {
							goodlist = item;
						}
					})
					if (goodlist) {
						goodlist.toBottom(type);
					}
				}
			},
		}
	}
</script>
