index.vue 1.49 KB
Newer Older
李嘉林 committed
1 2 3
<template>
  <!-- 内嵌组件 -->
  <div class="embed-module">
李嘉林 committed
4 5 6
    <div v-for="(item, index) in contentList" :key="index">
      <componentsGroup :item1="item" :index1="index" :active="active" :storageKey="'embed-mudule'+componentIndex+'_'+goodsListIndex+'_'+index" :goodsListIndex="goodsListIndex" :componentIndex="componentIndex"></componentsGroup>
    </div>
李嘉林 committed
7 8 9 10
  </div>
</template>

<script type="text/ecmascript-6">
李嘉林 committed
11
import componentsGroup from "@/components/componentsGroup/index.vue";
李嘉林 committed
12 13 14 15 16 17 18 19
import shop from "@/api/shop"
export default {
  name: "embed-module",
  props: {
    datas: {
      type: Object,
      default: {}
    },
李嘉林 committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
    index1: {
      type: Number,
      default: 0,
    },
    componentIndex: {
      type: Number,
      default: 0,
    },
    active: {
      type: Number,
      default: 0,
    },
    goodsListIndex: {
      type: Number,
      default: 0,
    },
李嘉林 committed
36 37 38
  },
  data() {
    return {
李嘉林 committed
39
      contentList: [],
李嘉林 committed
40 41 42
    }
  },
  components: {
李嘉林 committed
43
    componentsGroup
李嘉林 committed
44 45 46 47 48 49
  },
  computed: {
    microPageId() {
      return this.datas.componentData.microPageId;
    },
  },
李嘉林 committed
50
  created() {
李嘉林 committed
51 52 53 54 55 56 57
    this.init();
  },
  mounted() { },
  methods: {
    init() {
      shop.singlePageInfo({ id: this.microPageId }).then(res => {
        if (res.data.code == 200) {
李嘉林 committed
58 59
          this.contentList = res.data.data.pageData ? JSON.parse(res.data.data.pageData) : [];
          console.log(this.contentList, '------------------------45')
李嘉林 committed
60 61 62 63 64 65 66 67 68 69
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.embed-module {}
</style>