Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个需要在网页中一次显示 3 个的数据列表
第一个需要显示在名为“left”的 div 中,第二个需要显示在名为“centre”的 div 中,第三个需要显示在名为“right”的 div 中。
而且我需要能够使用寻呼机滚动浏览数据。以此类推,接下来的 3 个结果会以类似的方式显示,以此类推,直到数据集结束
显然中继器中的交替模板不适合这种情况。
有没有更聪明的方法来实现这一目标?
试试这样的循环
for (int i = 3; i < enumerable.length + 3; i++) {
if (i % 3 == 0) { // Put it in div 1 { else if (i % 3 == 1) { // put it in div 2 { else if (i % 3 == 2) { // put it in div 3 {
}
第一次通过,它将使用 div1,第二次使用 div2,第三次使用 div3,然后第四次使用 div1,以此类推……