weex icon indicating copy to clipboard operation
weex copied to clipboard

repeat 的{{$index}}不能作为参数传到函数里面吗?

Open DangDangHellen opened this issue 9 years ago • 1 comments

<div class="selectnum" repeat="( index, v) in arr"> <text value="{{v.id}}" onclick="selectfunc(arr[{{index}}].id)" class="select_player1">{{v.id}}</text> </div>

<script> module.exports = { data: { arr: [ {id: 10}, {id: 11}, {id: 12}, {id: 13}, {id: 14} ], select_player:"谁会中奖呢?" }, methods: { selectfunc: function(index){ this.select_player = '玩家'+index; } } } </script>

点击之后没有反应

DangDangHellen avatar Dec 20 '16 13:12 DangDangHellen

你的写法有问题onclick="selectfunc(arr[{{index}}].id)" 改成 onclick="selectfunc(arr[index].id)"

0326 avatar Dec 21 '16 12:12 0326