问一个关于{{}}的小白问题

发布于 7 年前作者 dongfang13137 次浏览最后编辑 7 年前来自 ask

<template name=‘report_head’>

<view class=“tab-item {{currentTab==0?‘active’:‘’}}” data-current=“0” bindtap=“swichNav”>1</view>

</template>

这里我打算进行循环遍历,有没有办法将下图画圈进行自增,

WXOPEN Club 内容图片

{{0++}},不起用

2 回复
juntan
juntan1 楼6 年前

0写成index就行了

tsun
tsun2 楼5 年前

<template name='report_head'>

<view class="tab-item {{currentTab==0?'active':''}}" wx:for="{{ arr }}" data-current="{{  index }}" bindtap="swichNav">1</view>

</template>