<!--
    上传图片的弹窗
-->

<template>
  <el-dialog title="上传图片" :visible.sync="dialog.uploadImgs" width="460px">
    <upload-imgs :readOnly="read" :keysArr="deepcopy(keysArr)" @change="changeItem" max="2"></upload-imgs>
  </el-dialog>
</template>
<script>
import uploadImgs from "@/components/lib/uploadImgsName";
export default {
  components: {
    uploadImgs
  },
  props: {
    dialog: {
      type: Object,
      default: function () {
        return {
          uploadImgs: true
        };
      }
    },
    keysArr: {
      type: Array,
      default: function () {
        return []
      }
    },
    read: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {};
  },
  created() { },
  mounted() { },
  methods: {
    deepcopy(obj) {
      //   var out = [],
      //     i = 0,
      //     len = obj.length;
      //   for (; i < len; i++) {
      //     if (obj[i] instanceof Array) {
      //       out[i] = this.deepcopy(obj[i]);
      //     } else out[i] = obj[i];
      //   }
      console.log(obj, "out")
      return obj;
    },
    changeItem(file) {
      console.log(file, "changed")
      this.$emit("changeFile", file)
    }
  },
};
</script>
<style>
</style>