uploadFile--.vue 1.28 KB
Newer Older
qzhxx's avatar
qzhxx committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
<template>
  <el-upload
  class="upload-demo"
  ref="upload"
  action="http://192.168.110.67/mall/file/video/content/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) {
      const data = res.data.fileList
      let newArray = data.map((item) => {
          return item.id;
      })
      this.$emit('videoList', newArray)
      // console.log(newArray,'----idArray')
    },
      submitUpload() {
        this.$refs.upload.submit();
      },
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      handlePreview(file) {
        console.log(file);
      }
    }
  }
</script>

<style>

</style>