0
我試圖序列KineticJS對象(有一個添加的屬性),以JSON對象,但如果我叫JSON.stringify(test);
,它返回KineticJS對象的唯一JSON表示沒有我添加的屬性。有誰知道,請問哪裏可能有問題?KineticJS與添加的屬性,以JSON
test = new Kinetic.Line(
{
points : [ 29, 30, 31, 32 ],
stroke : 'black',
strokeWidth : 2,
lineJoin : 'round',
id : '#line'
});
test.obj = "my own property";
JSON.stringify(test);
回報
{"attrs":{"points":[{"x":29,"y":30},{"x":31,"y":32}],"stroke":"black","strokeWidth":2,"lineJoin":"round","id":"#line"},
"nodeType":"Shape","shapeType":"Line"}"
但我也需要約test.obj信息..