problem description
1. Element+vue uploads pictures to Qiniuyun
2, uptoken is removed from the backend in before-upload
hook
3, before-upload
has not been returned during the first processing, and upload operation is performed. Upload error
4. Subsequent uploads can be uploaded normally using token,
related codes
<el-upload ref="upload"
action="//up.qbox.me/"
:show-file-list="false"
:data="upToken"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
accept="image/jpeg,image/gif,image/png,image/jpeg"
style="display:inline">
<el-button size="small"></el-button>
</el-upload>
//
return {
// token
upToken: {}
}
//
//
// token
beforeUpload (file) {
axios({
method: "get",
url: "/get_qiniu_token",
}).then(response => {
this.upToken = {token: response.data.msg}
})
},
uploadSuccess(response, file, fileList){
console.log(file)
},
what result do you expect?
whether the token, can be obtained when uploading for the first time and then upload