UEditor使用笔记
2018-12-28 本文已影响12人
你的代码写得很烂
- 跨域上传图片
uploadUrl = "服务器地址";
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function(action) {
if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
return uploadUrl;
} else if (action == 'uploadvideo') {
return uploadUrl;
} else {
return this._bkGetActionUrl.call(this, action);
}
}
- 上传图片时GET传参
ue.execCommand('serverparam', function(editor) {
return {
'type': 'image'
};
});
- 上传图片时POST传参
/ueditor/dialogs/image/image.js
uploader.on('uploadBeforeSend', function (file, data, header) {
//这里可以通过data对象添加POST参数
header['X_Requested_With'] = 'XMLHttpRequest';
data['type'] = 'image';//POST添加type参数
});
1.上传图片时POST传参暂时没找到;
2.上传图片返回json格式自定义处理未找到解决办法。