我基于 fabric.Textbox 创建了一个子类,但无法让 loadFromJSON 在其上运行。结果是
"caught TypeError: t.split is not a function"
.
这是我的代码:
fabric.TextboxSubclass = fabric.util.createClass(fabric.Textbox, {
type: 'TextboxSubclass',
toObject: function () {
return fabric.util.object.extend(this.callSuper('toObject'), {});
},
});
fabric.TextboxSubclass.fromObject = function (object, callback) {
return fabric.Object._fromObject('TextboxSubclass', object, callback);
};
var textfield = new fabric.TextboxSubclass('load from JSON', {});
designer_canvas.add(textfield);
我在这里缺少什么?