<template>
  <el-upload
    class="upload-demo"
    action="/uapi/pub/upload"
    :data="{type:'freework_level'}"
    multiple
    :limit="3"
    :on-success="success"
    :file-list="fileList">
    <el-button size="small" type="primary">点击上传面试视频</el-button>
  </el-upload>
</template>
<script>
  export default {
    data() {
      return {
        fileList: [],
        id: 0,
      };
    },
    props: {//接收上级参数
      'fileList':{
          type: Object,
      },
      'id':{
        type: Number,
      }
    },
    methods: {
      success(e){
        //保存文件
        if(e.status!=1)
        {
          this.fileList=[];
          this.$message({
            message:"文件上传失败",
            type:"error"
          });
        }
        else
        {
          //保存文件
          this.$emit('click',this.id,e.data.url);
        }
      },
    }
  }
</script>
<style scoped>
  .upload-demo{display: inline-block}
</style>
