Skip to content

Latest commit

 

History

History
56 lines (43 loc) · 956 Bytes

README.md

File metadata and controls

56 lines (43 loc) · 956 Bytes

vue-image-uploader

Vue2 图片选择上传组件,支持多选和拖放

DEMO

Props

参数 类型 说明 默认值
maxSize Number 单张图片最大大小 3072
placeholder String 占位文字 点击上传图片

Events

参数 说明
onChange 文件更改时触发事件

Example

HTML:

  <div class="hello">
    <image-inputer @onChange="imgChange" :maxSize="maxSize" placeholder="选择图片"></image-inputer>
  </div>

JavaScript:

  import ImageInputer from '@/components/ImageInputer.vue'

  export default {
    name: 'hello',
    data () {
      return {
        maxSize: 3072
      }
    },
    components: {
      ImageInputer
    },
    methods: {
      imgChange (files) {
        if (files) {
          console.log(files)
        }
      }
    }
  }
</script>