官網: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>