vxe-upload 上传附件显示进度

官网:https://vxeui.com/

<template>
  <div>
    <vxe-upload v-model="fileList" multiple show-progress :upload-method="uploadMethod"></vxe-upload>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  data () {
    const fileList = []
    const uploadMethod = ({ file }) => {
      const formData = new FormData()
      formData.append('file', file)
      return axios.post('/api/pub/upload/single', formData).then((res) => {
        return {
          ...res.data
        }
      })
    }
    return {
      fileList,
      uploadMethod
    }
  }
}
</script>
posted @ 2024-11-22 15:56  可不简单  阅读(0)  评论(0编辑  收藏  举报