alternate row style with $index binding

后端 未结 2 1206
遇见更好的自我
遇见更好的自我 2021-02-06 22:40

I am having trouble getting an alternate-row css class applied to a knockout template with a foreach binding context. I am using knockout 2.1 with the available $index

2条回答
  •  礼貌的吻别
    2021-02-06 23:12

    Don't do alternate row styling with Javascript, use CSS which is way more efficient :)

    https://developer.mozilla.org/en-US/docs/CSS/:nth-child

提交回复
热议问题