嗨如何命名和销毁对象的实例?请参阅我在 jsfiddle 中的工作
declare("obj_Button", [_WidgetBase], {
buildRendering: function () {
// create the DOM for this widget
this.domNode = domConstruct.create("button", {
innerHTML: "New Button Instance"
});
}
});
on(dom.byId('btn1'), "click", function(evt)
{
(new obj_Button()).placeAt(dom.byId('id'));
//name the instance
});
parser.parse(); // check out more!
on(dom.byId('btn2'), "click", function(evt)
{
// destroy the instance by name, not object
});
请指教。谢谢