view-design / ViewUI

A high quality UI Toolkit built on Vue.js 2.0
https://www.iviewui.com/
Other
2.65k stars 797 forks source link

[Feature Request]Upload组件 支持覆盖默认的上传行为 #1100

Open ZhaoQi99 opened 2 years ago

ZhaoQi99 commented 2 years ago

What problem does this feature solve?

覆盖默认的上传行为,可以自定义上传的实现

What does the proposed API look like?

https://element.eleme.cn/#/zh-CN/component/upload 参见http-request

<template>
    <Upload action="" :http-request="upload">
        <Button icon="ios-cloud-upload-outline">Upload files</Button>
    </Upload>
</template>
<script>
export default {
  data() {
    return {};
  },

  methods: {
    upload({ file }) {
      let form = new FormData()
      form.append('file', file)
      return uploadFile(form)
    }
  }
};
</script>