export default {
  name: 'my-image',
  render(h) {
    const data = this.obj
    const Attrs = {
      required: data.required,
      limit: 3,
      accept: 'image/*',
      'on-exceed': this.handleExceed
    }
    return (
      <el-form-item label={this.obj.fieldNm} required={this.obj.required == 1}
                    style="width:100%;margin-bottom:10px!important">
        <el-upload
          class="upload-demo"
          multiple
          attrs={Attrs}
        >
          <i class="el-icon-picture-outline" style='font-size: 18px;position: absolute;right: 20px;top: 10px;'></i>
        </el-upload>
      </el-form-item>
    );
  },
  data() {
    return {
      date: ''
    }
  },
  methods: {
    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`)
    }
  },
  props: {
    obj: {
      type: Object,
      default: {}
    }
  }
}
