<template>
  <van-swipe class="my-swipe" indicator-color="white">
    <template v-for="(item, index) in page.hoversList" :key="index">
      <van-swipe-item>
        <div class="pageItem" :style="{ background: item.background_url }">
          <component
            v-for="(v, i) in item.components"
            :key="'son' + index + i"
            :is="components[v.type]"
            :item="v"
          ></component>
        </div>
      </van-swipe-item>
    </template>
  </van-swipe>
</template>
<script setup>
// import { onMounted, reactive } from "vue";
import { ref } from 'vue';
// import { isIpad, isIpod, isIphone } from "../../utils/isTerminal";
import { getPageParameters } from '../../api/index';
import localImage from '../../components/image.vue';
import localParagraph from '../../components/paragraph.vue';
import localFromComponent from '../../components/fromComponent.vue';
/**
 * window.$originData.orginParames.title 页面标题
 * window.$originData.orginParames.parameters 固定参数值
 * window.$originData.urlParames url参数
 */

// @ts-ignore
console.log(window.$originData);
/**
 * 页面数据
 * @type {object}
 */
const page = ref({});
const components = {
  image: localImage,
  paragraph: localParagraph,
  fromComponent: localFromComponent,
};

getPageParameters().then(r => {
  page.value = r[0];
  document.title = page.value.title;
});
</script>
<style>
.page {
  width: 100vw;
  height: 100vh;
}
.pageItem {
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
}
</style>
