<template>
  <app-upload class="video-uploader" accept="video/*" :show-file-list="false" v-bind="$attrs" v-on="$listeners">
    <img v-if="videoUrl" :src="`${videoUrl}?x-oss-process=video/snapshot,t_10,f_jpg,w_0,h_0,m_fast`" class="avatar" />
    <i v-else class="el-icon-plus video-uploader-icon"></i>
  </app-upload>
</template>
<script>
import AppUpload from './Upload.vue'
export default {
  name: 'AppUploadVideo',
  components: { AppUpload },
  data() {
    return {}
  },
  computed: {
    videoUrl() {
      return this.$attrs.value
    }
  }
}
</script>
<style lang="scss">
.video-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  width: 148px;
  height: 148px;
}
.video-uploader .el-upload:hover {
  border-color: #409eff;
}
.video-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  line-height: 148px;
  text-align: center;
}
.avatar {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
</style>
