【发布时间】:2017-01-09 13:08:36
【问题描述】:
我在 Enyo 应用中有一个重复项目。在当前设置中,点击中继器项目不会显示过渡或视觉提示来表明它已被点击。
所以我尝试的是设置从中继器上的 ontap 事件传入的中继器项目的类。
但是进入开发工具告诉我属性 addClass 没有定义:
IncidentTickets.js:653 Uncaught TypeError: Cannot read property 'addClass' of undefined
问题:
如何设置 Enyo 中继器项目背景颜色?
基本上我将 CSS 样式的背景颜色设置为绿色:
.tapped {
background: #0CA281;
}
尝试将 CSS 类添加到传递给 onTap 事件的中继器项:
tapPopupBundle: function(inSender, inEvent) {
var item = this.$.repeaterBundle.itemAtIndex(inEvent.index);
this.item.addClass('tapped');
},
这是中继器种类的定义:
{kind: "Scroller", name: "scrollerBundle", touch: true, horizontal:"hidden", showing: false, style: "height: 70%", components: [
{content:"All Apps", style: "font-size: 12px; font-weight: bold; margin-left: 20px; text-decoration:underline;",ontap: 'clearFilters'},
{kind: "Repeater", name: "repeaterBundle", count: 0, onSetupItem: "setupBundle", ontap: "tapPopupBundle", components: [
{tag: "br"},
{ kind: "FittableColumns", components: [
{name: "repBundle", style: "font-size: 12px; font-weight: bold; margin-left: 20px;"}
]}
]},
]},
【问题讨论】:
标签: javascript css repeater enyo