<template>
  <div>
    <component
      v-if="type"
      :is="type"
      :objType="objType"
      :objCode="objCode"
      :compareHData1="compareHData1"
      :compareHData2="compareHData2"
      :preVersion="preVersion"
      :curVersion="curVersion"
      @reverCallback="$emit('reverCallback')"
    />
  </div>
</template>
<script>
import formTemplateCompareView from "./formTemplateCompareView.vue";
import formScriptCompareView from "./formScriptCompareView.vue";
import tableModelCompareView from "./tableModelCompareView.vue";
export default {
  name: "compareContent",
  components: {
    formTemplateCompareView,
    formScriptCompareView,
    tableModelCompareView,
  },
  props: {
    objType: {
      type: String,
      default: "",
    },
    objCode: String,
    compareHData1: {
      type: Object,
      default: () => ({}),
    },
    compareHData2: {
      type: Object,
      default: () => ({}),
    },
    preVersion: [String, Number],
    curVersion: [String, Number],
  },
  data() {
    return {
      type: null,
    };
  },
  created() {
    this.initType();
  },
  methods: {
    initType() {
      this.type =
        this.objType === "FormTemplate"
          ? "formTemplateCompareView"
          : this.objType === "FormScript"
          ? "formScriptCompareView"
          : "tableModelCompareView";
    },
  },
};
</script>
