提交 edd7281d 编写于 作者: fxy060608's avatar fxy060608

fix(v3): dataset

上级 cb4c0b87
...@@ -2328,7 +2328,7 @@ var serviceContext = (function () { ...@@ -2328,7 +2328,7 @@ var serviceContext = (function () {
} else if (res.errMsg.indexOf(':cancel') !== -1) { } else if (res.errMsg.indexOf(':cancel') !== -1) {
res.errMsg = apiName + ':cancel'; res.errMsg = apiName + ':cancel';
} else if (res.errMsg.indexOf(':fail') !== -1) { } else if (res.errMsg.indexOf(':fail') !== -1) {
res.errMsg = apiName + ':fail'; res.errMsg = apiName + ':fail' + res.errMsg.substr(res.errMsg.indexOf(' '));
} }
const errMsg = res.errMsg; const errMsg = res.errMsg;
...@@ -6204,7 +6204,7 @@ var serviceContext = (function () { ...@@ -6204,7 +6204,7 @@ var serviceContext = (function () {
hasContentType = true; hasContentType = true;
headers['Content-Type'] = header[name]; headers['Content-Type'] = header[name];
// TODO 需要重构 // TODO 需要重构
if (method === 'POST' && header[name].indexOf('application/x-www-form-urlencoded') === 0) { if (method !== 'GET' && header[name].indexOf('application/x-www-form-urlencoded') === 0 && typeof data !== 'string' && !(data instanceof ArrayBuffer)) {
let bodyArray = []; let bodyArray = [];
for (let key in data) { for (let key in data) {
if (data.hasOwnProperty(key)) { if (data.hasOwnProperty(key)) {
...@@ -6275,7 +6275,7 @@ var serviceContext = (function () { ...@@ -6275,7 +6275,7 @@ var serviceContext = (function () {
requestTaskId, requestTaskId,
state: 'fail', state: 'fail',
statusCode, statusCode,
errMsg: 'abort' errMsg: 'abort statusCode:' + statusCode
}); });
} }
}); });
...@@ -10154,36 +10154,38 @@ var serviceContext = (function () { ...@@ -10154,36 +10154,38 @@ var serviceContext = (function () {
invokeMethod('operateMapPlayer', mapId, pageVm, type, data); invokeMethod('operateMapPlayer', mapId, pageVm, type, data);
} }
UniServiceJSBridge.subscribe('onMapMethodCallback', ({
callbackId,
data
}) => {
callback.invoke(callbackId, data);
});
const methods = ['getCenterLocation', 'translateMarker', 'getScale', 'getRegion'];
class MapContext { class MapContext {
constructor (id, pageVm) { constructor (id, pageVm) {
this.id = id; this.id = id;
this.pageVm = pageVm; this.pageVm = pageVm;
} }
getCenterLocation (args) {
operateMapPlayer$3(this.id, this.pageVm, 'getCenterLocation', args);
}
moveToLocation () { moveToLocation () {
operateMapPlayer$3(this.id, this.pageVm, 'moveToLocation'); operateMapPlayer$3(this.id, this.pageVm, 'moveToLocation');
} }
translateMarker (args) {
operateMapPlayer$3(this.id, this.pageVm, 'translateMarker', args);
}
includePoints (args) { includePoints (args) {
operateMapPlayer$3(this.id, this.pageVm, 'includePoints', args); operateMapPlayer$3(this.id, this.pageVm, 'includePoints', args);
} }
getRegion (args) {
operateMapPlayer$3(this.id, this.pageVm, 'getRegion', args);
} }
getScale (args) { methods.forEach(function (method) {
operateMapPlayer$3(this.id, this.pageVm, 'getScale', args); MapContext.prototype[method] = callback.warp(function (options, callbackId) {
} operateMapPlayer$3(this.id, this.pageVm, method, {
} options,
callbackId
});
});
});
function createMapContext$1 (id, context) { function createMapContext$1 (id, context) {
if (context) { if (context) {
...@@ -10277,7 +10279,7 @@ var serviceContext = (function () { ...@@ -10277,7 +10279,7 @@ var serviceContext = (function () {
callback.invoke(callbackId, data); callback.invoke(callbackId, data);
}); });
const methods = ['insertDivider', 'insertImage', 'insertText', 'setContents', 'getContents', 'clear', 'removeFormat', 'undo', 'redo']; const methods$1 = ['insertDivider', 'insertImage', 'insertText', 'setContents', 'getContents', 'clear', 'removeFormat', 'undo', 'redo'];
class EditorContext { class EditorContext {
constructor (id, pageId) { constructor (id, pageId) {
...@@ -10294,7 +10296,7 @@ var serviceContext = (function () { ...@@ -10294,7 +10296,7 @@ var serviceContext = (function () {
} }
} }
methods.forEach(function (method) { methods$1.forEach(function (method) {
EditorContext.prototype[method] = callback.warp(function (options, callbackId) { EditorContext.prototype[method] = callback.warp(function (options, callbackId) {
operateEditor(this.id, this.pageId, method, { operateEditor(this.id, this.pageId, method, {
options, options,
......
...@@ -6693,7 +6693,12 @@ function parseDataset(attrs) { ...@@ -6693,7 +6693,12 @@ function parseDataset(attrs) {
var dataset = Object.create(null); var dataset = Object.create(null);
Object.keys(attrs).forEach(function (name) { Object.keys(attrs).forEach(function (name) {
if (name.indexOf('data-') === 0) { if (name.indexOf('data-') === 0) {
dataset[camelize(name.replace('data-', ''))] = JSON.parse(attrs[name]); var camelizeName = camelize(name.replace('data-', ''));
try {
dataset[camelizeName] = JSON.parse(attrs[name]);
} catch (e) {
dataset[camelizeName] = attrs[name];
}
} }
}); });
return dataset return dataset
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册