<block wx:for="{{a}}" wx:for-item=“item” >
<view data-index="{{index}}">
<block wx:for="{{item.b}}" >
<input type=“text” bindfocus=“index” data-index="{{index}}">
</block>
<view>
</block>
input获得焦点的时候怎么获取上一层循环的index呢?
自己定义index和item
<block wx:for="{{a}}" wx:for-index=“father_index” wx:for-item=“father_item”>
<view data-index="{{father_index}}">
<block wx:for="{{father_item}}" wx:for-index=“son_index” wx:for-item=“son_item”>
<input type=“text” value="{{son_item.value+father_index+son_index}}" data-index="{{father_index}}" />
</block>
</view>
</block>
data: {
a: [
[{ value: “a” }, { value: “b” }, { value: “c” }],
[{ value: “d” }, { value: “e” }, { value: “f” }],
[{ value: “g” }, { value: “h” }, { value: “i” }]
]
}
咫尺开发论坛——小乐