如何设置重复器项目背景颜色
How to style Repeater item background color ontap?
我在Enyo应用程序中有一个项目重复器。在当前设置中,点击重复器项目不会显示过渡或视觉提示,显示它已被点击。
所以我尝试的是设置从ontap事件传入的repeater项目的类。
但是进入Dev工具告诉我属性addClass没有定义:
IncidentTickets.js:653 Uncaught TypeError: Cannot read property 'addClass' of undefined
问题:
如何设置Enyo Repeater项目的背景颜色?
我设置了一个CSS样式的背景色为绿色:
.tapped {
background: #0CA281;
}
尝试将CSS类添加到传递给onTap事件的repeater项:
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;"}
]}
]},
]},
获取传入的item id并调用appLlyStyle在本例中起作用:
item.$.repAppName.applyStyle("background-color", 'rgb(12,162,129)');
相关文章:
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 正在将数据主题添加到所有项目
- 在BootStrap菜单栏中为所选项目设置背景,类似于BootStrap中的父导航选项
- 使用圆中的数组更改背景颜色项目
- 单击项目以更改另一个项目的背景图像
- 加载所有项目后更新背景
- 如何在项目符号列表中插入背景(图片)元素,其 URL 写入相邻的项目符号列表中
- 在导航中对活动项目背景进行动画处理失败
- Foreach项目悬停在不同的背景上
- 如何更改项目's的背景颜色使用jquery平滑
- HTML选择选项多次更改选中的项目灰色背景时,不在焦点上
- 如何改变所有选定的项目背景/类,而不是只改变一个选定的项目在ng-repeat角
- 当项目被点击改变背景颜色- CSS(没有jQuery)
- 如何使用jQuery设置每个项目的背景颜色到下一个项目
- 如何设置重复器项目背景颜色
- 当弹出框处于活动状态时,如何在离子中与背景中的项目进行交互
- 无法更改 UL 中所选 li 项目的背景颜色
- 如何更改表中项目的背景
- 如何动态地添加一个类到li项目,并使用javascript和css改变它的背景颜色
- 设置悬停项目的背景