js
bindManual:
function(e){
var that=
this;
var id = e.currentTarget.id;
console.log(id)
that.setData({
num: e.detail.value
})
console.log(that.data.num)
},
bindMinus:
function(e){
var that =
this
var index = e.currentTarget.id
var newnum = that.data.num
--newnum
var newarr = that.data.newarry
newarr[index] = newnum
that.setData({
newarry: newarr
})
},
bindPlus:
function(e){
var that =
this
var index = e.currentTarget.id
var newarr = that.data.newarry
var newnum = that.data.num
newnum++
newarr[index] = newnum
that.setData({
newarry: newarr
})
},
<
scroll-view
class=
"attr"
scroll-y=
"true">
<
checkbox-group
bindchange=
"checkboxChange"
wx:for=
"{{priceCombos}}"
data-index=
"{{index}}">
<
view
class=
'package'>
<
checkbox
value=
"key1"
checked=
""
/
><
text
>{{item.comboExtra}}
</
text
><
text
class=
'pricecolor'>¥39999
</
text
>
<
view
class=
"num">
<
view
class=
"stepper">
<!-- 减号 -->
<
text
class=
"{{goods_number == 1 ? 'disabled' : 'normal'}}"
bindtap=
"bindMinus"
id=
'{{index}}'>-
</
text
>
<!-- 数值 -->
<
input
type=
"number"
bindchange=
"bindManual"
value=
"{{newarry[index]||1}}"
id=
'{{index}}'
/
>
<!-- 加号 -->
<
text
class=
"normal"
bindtap=
"bindPlus"
id=
'{{index}}'>+
</
text
>
</
view
>
<
label
>购买数量
</
label
>
</
view
>
<
view
class=
'explain'>{{item.comboDesc}}
</
view
>
</
view
>
</
checkbox-group
>
</
scroll-view
>
怎么能使操作for循环里的单个input,我改变第一个value的值第二个也会变