方法1(默认方式):
<el-upload
action="http://irhfuwu.com:5566/OE/UploadFile/AttachUpload";
multiple
:limit="3"
:headers="myHeaders" //注:此处也可以使用computed来传动态值
:on-success="sucH">
<el-button size="small" type="primary">点击上传1</el-button>
</el-upload>
...
data: {
myHeaders: {
token: "324234234234324343pz9cvbg3Rw="
}
},
方法2(不用action,改用自写ajax方式):
<el-upload
action="#"
:before-upload="beforeUpload"
multiple
:limit="3"
:on-success="sucH">
<el-button size="small" type="primary">beforeUpload方式上传</el-button>
</el-upload>
....
beforeUpload:function (file) {
var fd = new window.FormData();
fd.append('key', file, 'fileName')
axios.post("http://irhfuwu.com:5566/OE/UploadFile/AttachUpload";, fd, {
headers: {
token: "456436523YZgX6PXALReS5l51QwzVf0eQnYvDJJBKxG91Wpz9cvbg3Rw="
}
}).then(function (res) {
console.log(res);
});
return false // 返回false不会自动上传
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。