<template>
  <y-upload
    class="cell-upload"
    action=""
    :limit="1"
    v-bind="$attrs"
    @on-success="handleUpload"
    @on-remove="handleUpload"
  >
  </y-upload>
</template>

<script>

export default {
  name: 'UploadCell',
  props: {
    value: {
      type: String,
      default: null
    }
  },
  data() {
    return {
      imageUrl: ''
    }
  },
  methods: {
    handleUpload({ fileList }) {
      this.$emit('input', fileList.length ? fileList[0]?.url : null)
    },
    beforeUpload(file) {

    }
  }

}
</script>

<style lang="scss" scoped>
$cell-width: 60px;
.cell-upload ::v-deep .y-upload {
  width: $cell-width;
  height: $cell-width;
  .el-upload {
    width: $cell-width;
    height: $cell-width;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  ul>li {
    width: $cell-width;
    height: $cell-width;
  }
}
</style>
