<template name="topic-name">
  <div
    id="topic"
    :style="styleData.topicbox"
    ref="topic"
    @click.stop="styleClick('click', 'topic')"
    @mousemove.stop="styleClick('mousemove', 'topic')"
    @mouseout.stop="styleClick('mouseout')"
  >
    {{ topictext }}
  </div>
</template>
<script>
import bus from "../../../util/bus";
export default {
  props: [
    "isTemplate",
    "datas",
    "styleData",
    "keyData",
    "templateData",
    "isWebClick",
    "modifyContent",
  ],
  data() {
    return {
      topictext: "话题?",
      styleDataOld: {},
    };
  },
  created() {
    //深拷贝重置需要
    this.styleDataOld = JSON.parse(JSON.stringify(this.styleData));
    this.initdata();
  },
  methods: {
    //点击可修改位置的方法
    styleClick(type, refName) {
      if (this.isWebClick) {
        //传值给B端
        let byValue = {
          modifyContent: this.modifyContent,
          refName: refName,
          styleData: this.styleData,
          styleDataOld: this.styleDataOld,
          c_this: this,
          isCustomSwitching: this.isCustomSwitching,
        };
        this.$emit("opertaionCom", type, byValue);
      }
    },
    initdata() {
      if (this.isTemplate) {
        this.$toast("活动预览，仅供查看");
        var datasAll = this.templateData;
        if (datasAll) {
          this.topictext = datasAll.bulidingSettingData.activityTopic;
        } else {
          this.topictext = "什么样的平板电视才能满足您的需求";
        }
        return;
      }
      bus.$on("data", (content) => {
        this.topictext = content.activityTopic;
      });
    },
  },
};
</script>
<style scoped>
#topic {
  position: relative;
}
</style>