<block wx:for="{ {tips}}">
<view style="width:100%;height:200rpx;">
<input id="{ {index}}" value="{ {inputValue}}" bindfocus="bindFocus" bindinput="bindKeyInput" placeholder="输入文字以继续"/>
</view>
</block>
Page({
data: {
tips: [
{
id: 0
},
{
id: 1
}
],
inputValue: '',
focusId: ''
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
},
bindFocus: function (event) {
var id = event.currentTarget.dataset.id
console.log(id)
this.setData({
focusId: id
})
},
bindKeyInput: function (event) { </