<template>
  <div :style="styleData.shareTheBackground" ref="sharedCollection" @click="styleClick('click', 'sharedCollection')"
    @mousemove="styleClick('mousemove', 'sharedCollection')" @mouseout="styleClick('mouseout')">
    <img :style="styleData.shareTheImg" :src="styleData.shareTheImg.imageUrl" alt="">
    <component ref="dataRef" v-for="(value, key, index) in componentsData" :key="index" :is="key"
      :isTemplate="isTemplate" :styleData="styleData" :datas="datas" :templateData='templateData' :keyData="keyData"></component>
  </div>
</template>

<script>
import testimonialNew from "../prizeShow/testimonialDz43.vue";
import shareButtonNew from "../../logicalComponent/shareButton/shareButtonNew.vue";
import inviteNew from "../../logicalComponent/invite/inviteNew.vue";
export default {
  props: [
    "isTemplate",
    "datas",
    "styleData",
    "keyData",
    "templateData",
    "modifyContent",
    "isWebClick",
  ],
  components: {
    testimonialNew,
    shareButtonNew,
    inviteNew,
  },
  data() {
    return {
      componentsData: {
        testimonialNew,
        inviteNew,
        shareButtonNew,
      },
    };
  },
  created() {
    //深拷贝重置需要
    this.styleDataOld = JSON.parse(JSON.stringify(this.styleData));
    //如果父组件传递过来的样式数据则使用样式数据否则使用默认数据
    this.styleDataNew = this.styleData; //父组件传递过来的样式数据
    console.log(323, this.styleData)
  },
  methods:{
     //点击可修改位置的方法
    styleClick(type, refName) {
      if (this.isWebClick) {
        //传值给B端
        let byValue = {
          modifyContent: this.modifyContent,
          refName: refName,
          styleData: this.styleDataNew,
          c_this: this,
          styleDataOld: this.styleDataOld,
        };
        this.$emit("opertaionCom", type, byValue);
      }
    },
  }
};
</script>

<style></style>
