SOURCE

console 命令行工具 X clear

                    
>
console
new Vue({
    el: '#app',
    data(){
        return {
            file: '', // 文件
        }
    },
    methods: {
        onchange(e){
            this.file = e.target.files[0]
        },
        submit(){
            const formdata = new FormData()
            formdata.append('param1', '参数1')
            formdata.append('fileKey', this.file)
            axios.post('/api/test', formdata, {
             headers:{"Content-Type":"multipart/form-data"}
            })
        }
    }
})
<div id="app">
    <input type="file" @change="onchange">
    <button @click="submit">上传</button>
</div>

本项目引用的自定义外部资源