<template>
  <component
    :is="useEditComponent"
    :type="type"
    :curInfo="curInfo"
    :selectId="selectId"
    :curId="curId"
    @toUpdate="toUpdate"
    @cancel="cancel"
  ></component>
</template>

<script>
import Type1 from "./type1.vue";
import Type2 from "./type2.vue";
import Type3 from "./type3.vue";
import Type4 from "./type4.vue";
import Type5 from "./type5.vue";
import Type6 from "./type6.vue";

export default {
  data() {
    return {};
  },
  props: {
    type: {
      type: [Number, String],
      defualt: null
    },
    curInfo: {
      type: Object,
      default: () => {}
    },
    curId: {
      type: [Number, String],
      defualt: null
    },
    selectId: {
      type: [Number, String],
      defualt: null
    }
  },
  computed: {
    useEditComponent() {
      return `Type${this.type}`;
    },
  },
  components: {
    Type1,
    Type2,
    Type3,
    Type4,
    Type5,
    Type6,
  },
  methods: {
    toUpdate() {
      this.$emit("toUpdate");
    },
    cancel() {
      this.$emit("cancel");
    }
  }
};
</script>