<template>
  <el-card
    header="ele-form-image-uploader 演示"
    shadow="never"
    style="max-width: 1250px;margin: 20px auto;"
  >
    <ele-form
      :form-data="formObj.formData"
      :form-desc="formObj.formDesc"
      :request-fn="handleRequest"
      @request-success="handleSuccess">
    </ele-form>
  </el-card>
</template>

<script>
  export default {
    data() {
      return {
        formObj: {
          formData: {},
          formDesc: {
            avatar: {
              label: '图片',
              type: 'image-uploader',
              disabled:true,
              attrs: {
                multiple: {
                  default: true
                },
              }
            },
            fileDemo: {
              label: '附件上传',
              type: 'upload-file', // 只需要在这里指定为 upload-file 即可
              attrs: {
                // 上传地址
                action: 'http://172.16.90.8:81/dev-api/common/uploadac',
                //是删除
                isCanDelete: true
              }
            }
          }
        }

      }
    },
    methods: {
      handleRequest(data) {
        console.log(data)
        this.formObj.formData = data
        console.log(JSON.stringify(this.formObj))
        return Promise.resolve()
      },
      handleSuccess() {
        this.$message.success('提交成功')
      }
    },
    mounted() {
    }
  }
</script>

<style scoped>
  body {
    background-color: #f0f2f5;
  }
</style>
