<template>
  <div class="vue-image-choose">
    <slot></slot>
    <input type="file" class="input-file" multiple="multiple" @change.stop.prevent="handleChange" accept="image/*">
  </div>
</template>
<script>
export default {
  name: 'Choose',
  data() {
    return {}
  },
  methods: {
    handleChange(e) {
      let files = e.target.files || e.dataTransfer.files
      if(files.length > 9){
        alert('最多只能同时选择9张图片！')
        return
      }
      this.$emit('file-is-ready', {
        files: files
      })
    }
  }
}
</script>
