0
我測試後創造,所以我可以設立postcreate類的屬性,而不是調用這裏如何在Dojo中使用postCreate?
request("js/my/data/sample.json", {
handleAs: "json"
}).then(function (jsonResults) {
arrayUtil.forEach(jsonResults.LinksMap, function (List) {
arrayUtil.forEach(List.LinksMap.entry, function (Ientry) {
if ('information' === Ientry.linkType) Ientry.className = 'info';
else if ('news link' === Ientry.linkType) Ientry.className = 'news';
var widget = new support(Ientry).placeAt(authorContainer);
});
});
});
我試圖
postCreate: function() {
this.inherited(arguments);
},
_setLinkClssAttr: function (iconClass) {
if (iconClass != "") {
if ('information' === linkType) LinkClss = 'info';
if ('news link' === Ientry.linkType) LinkClss = 'news';
this._set("LinkClss", iconClass);
this.LinkNode.class = iconClass;
}
}
我的HTML模板看起來像這樣
<a class="${baseClass}LinkClss" href="${Link.url}" data-dojo-attach-point="LinkNode">${Link.title}</a>
保羅,這工作得很好。我做的唯一改變是domClass.add(this.linkNode,linkClass);爲1.8 – bumblebee 2013-04-25 22:35:37