【问题标题】:How to style Repeater item background color ontap?如何设置中继器项目背景颜色的样式?
【发布时间】: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


    【解决方案1】:

    在这种情况下,获取传入的项目 id 并调用 appLlyStyle:

    item.$.repAppName.applyStyle("background-color", 'rgb(12,162,129)'); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-29
      • 2019-09-28
      • 2019-06-21
      • 1970-01-01
      • 2015-03-04
      • 2014-03-14
      相关资源
      最近更新 更多