<template>
  <el-upload
  class="upload-demo"
  ref="upload"
  action="http://192.168.110.67/mall/file/audio/upload"
  :on-preview="handlePreview"
  :on-remove="handleRemove"
  :file-list="fileList"
  :on-success="handleAvatarSuccess"
  :auto-upload="false">
  <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
  <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
  <div slot="tip" class="el-upload__tip">（支持上传多个视频及视频文件夹，视频语言支持汉语、蒙语、藏语、维吾尔语、英语，视频命名规定：视频名称+语言）</div>
</el-upload>
</template>

<script>
  export default {
    data() {
      return {
        fileList: []
      };
    },
    methods: {
    handleAvatarSuccess(res, file) {
        console.log(res)
        console.log(res.data.fileList)
         const data = res.data.fileList
          let newArray = data.map((item) => {
              return item.id;
          })
        this.$emit('audioList', newArray)
       
    },
      submitUpload() {
        this.$refs.upload.submit();
      },
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      }
    }
  }
</script>

<style>

</style>