Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

add request header configuration #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ Vue.use(VueHtml5Editor, {
width: 1600,
height: 1600,
quality: 80,
// 请求头配置
// request header configuration
requestHeader: {},
// 响应数据处理
// handle response data,return image url
uploadHandler(responseText){
Expand Down
10 changes: 9 additions & 1 deletion dist/vue-html5-editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Vue-html5-editor 1.0.2
* https://github.com/PeakTai/vue-html5-editor
* build at Tue Mar 14 2017 18:41:09 GMT+0800 (CST)
* build at Wed Mar 15 2017 10:51:42 GMT+0800 (CST)
*/

(function (global, factory) {
Expand Down Expand Up @@ -438,6 +438,14 @@ var dashboard$3 = {
};

xhr.open('POST', config.server);

if (typeof config.requestHeader === 'object') {
Object.keys(config.requestHeader).forEach(function (key) {
xhr.setRequestHeader(key, config.requestHeader[key]);
});
}


xhr.send(formData);
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/modules/image/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ export default {
}

xhr.open('POST', config.server)

if (typeof config.requestHeader === 'object') {
Object.keys(config.requestHeader).forEach((key) => {
xhr.setRequestHeader(key, config.requestHeader[key])
})
}


xhr.send(formData)
}
}
Expand Down