Created
April 12, 2020 09:08
-
-
Save lolisTop/47191f7e55373b3be0bee01848afc249 to your computer and use it in GitHub Desktop.
wechat bind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/about/about.js | |
Page({ | |
/** | |
* 页面的初始数据 | |
*/ | |
data: { | |
inputList: [] | |
}, | |
onLoad() { | |
let inputList = []; | |
for (let index = 0; index < 2; index++) { | |
inputList.push({ text: index }); | |
} | |
this.setData({ | |
inputList | |
}); | |
}, | |
input(el) { | |
let inputList = this.data.inputList; | |
inputList[el.currentTarget.dataset.index].text = el.detail.value; | |
this.setData({ | |
inputList | |
}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<view class="view" wx:for="{{inputList}}" wx:key="index"> | |
<input bindinput="input" value="{{item.text}}" data-index="{{index}}" placeholder="输入信息" /> | |
</view> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment