问题
I have a mapbox-gl.js map with markers within a vue component. At the end of a mapdrag a list is made of all markers in the viewport (with a setTimeout to avoid performance issues with many markers). Everything works as expected but I get a error at the end of a drag/moveend:
Uncaught SyntaxError: Unexpected identifier
No further details..., the error refers e.g. to VM9336 which contains:
[object HTMLDivElement],[object HTMLDivElement],[object HTMLDivElement],[object HTMLDivElement]
The number of [object HTMLDivElement] 's matches the number of markers in viewport.
The error seems to emerge from this function of mapbox-gl.js:
Actor.prototype.receive = function(t) {
var e, a = this, r = t.data, s = r.id;
if (!r.targetMapId || this.mapId === r.targetMapId) {
var i = function(t, e, r) {
a.target.postMessage({
sourceMapId: a.mapId,
type: "<response>",
id: String(s),
error: t ? String(t) : null,
data: e
}, r)
};
if ("<response>" === r.type)
e = this.callbacks[r.id],
delete this.callbacks[r.id],
e && e(r.error || null, r.data);
else if ("undefined" != typeof r.id && this.parent[r.type])
this.parent[r.type](r.sourceMapId, r.data, i);
else if ("undefined" != typeof r.id && this.parent.getWorkerSource) {
var p = r.type.split(".")
, d = this.parent.getWorkerSource(r.sourceMapId, p[0]);
d[p[1]](r.data, i)
} else
this.parent[r.type](r.data)
}
}
As I am pretty much lost..., any idea?
EDIT: in Firefox (instead of Chrome) I get following errormessage:
SyntaxError: missing ] after element list 0.821efde866de69447c4f.js%20line%20491%20%3E%20eval:119:8
but when clicking on the code-link Firefox does not seem to be able to read the code...
来源:https://stackoverflow.com/questions/42856004/syntaxerror-missing-after-element-list