<template>
  <div style="widht:100px;height:42px">
    <el-upload
      class="upload-demo"
      :on-remove="handleRemove"
      :action="uploadUrl"
      :on-success="handleUploadSuccess"
      :file-list="fileData"
      :auto-upload="true"
      >
      <div class="greens" v-if="fileData.length ==0"> + 点击上传</div>
    </el-upload>
  </div>
</template>

<script>
  import {
    uploadUrl
  } from '@/utils/request'
    export default {

    data() {
      return {
        uploadFileUrl: uploadUrl, // 请求地址
        fileData:[],//上传附件
      }
    },
    created() {
    },
    computed: {

    },
    methods: {
      getFu(){
           this.$emit('childFujian', this.fileData);
      },
      handleRemove(file, fileList) {
        this.fileData = []
      },
      handleUploadSuccess(response, file, fileList) {
        const fileMsg = {
          name:file.name,
           url: file.response.data.url,
        }
        // 将文件地址存储在 uploadedFiles 数组中
        this.fileData.push(fileMsg);
      },
    }
  }
</script>

<style>
</style>
