<template>
	<view>
		<block v-for="item in initModule" :key="item.id">
			<component :is="item.component" :dataVal="item.fields.dataVal" :attrs="item.fields.attrs"
				:styles="item.fields.styles" />
		</block>

	</view>
</template>

<script>
	import {
		getTemplatePages
	} from "@/api/template.js"
	import Mixin from "./Mixin.js"
	export default {

		mixins: [Mixin],
		data() {
			return {
				initModule: [],
			}

		},


		onLoad(opt) {
			const {
				type
			} = opt
			if (type || type == '0') {
				this.getPages(type)
			}
		},

		methods: {
			getPages(type) {
				getTemplatePages(type).then(res => {
					const {
						page_code_json
					} = res.data
					if (page_code_json && page_code_json.customPagePart) {
						this.initModule = page_code_json.customPagePart
					}
				})
			}
		}

	}
</script>

<style>
</style>