Upload(正在开发中...)

<template>
  <div>
    <p>
      <z-upload 
        :filesList="filesList"
        @loadEnd="loadEnd" 
        @loadStart="loadStart" 
        @success="success" 
        @delete="deleteHandle"
      />
    </p>
  </div>
</template>
<script>
import Upload from "../../../src/components/upload/upload.vue";
import Button from '../../../src/components/button/button.vue'

export default {
  data(){
    return {
      filesList: []
    }
  },
  components: {
    "z-upload": Upload,
    "z-button": Button
  },
  methods: {
    loadEnd(data){
      console.log('结束',data)
    },
    loadStart(data, xhr){
      console.log('开始',data, xhr)
    },
    success(data, files, xhr){
      console.log(data, files, xhr)
    },
    deleteHandle(item, index, files){
      files.splice(index, 1);
      this.filesList = files
    }
  }
};
</script>
<style lang="scss" scoped>

</style>

Upload Props

属性 含义 类型 默认
multiple 是否多选 Boolean false
method 请求方法 String POST
url 上传路径 String
responseType 响应报文类型 String json
async 是否异步 Boolean true
name 上传的文件字段 String file
fileList 当前文件数量 Array []

Upload Events

属性 含义 类型 默认
success 上传成功后的回调 Function
delete 删除后的回调 Function
loadStart 上传开始时的回调 Function
loadEnd 上传结束后的回调 Function