2012-06-26 72 views

回答

1

dojo.mixin會這樣做。然而,一個小部件自動執行此操作。

// from _WidgetBase.create(/*Object?*/params, /*DomNode|String?*/srcNodeRef)  
if(params){ 
    this.params = params; 
    lang.mixin(this, params); 
} 

lang.mixin是從dojo/_base/lang

var w = new CustomWidget({a:1,b:2}, node); 
// w.a is 1 
// w.b is 2 
dojo.mixin