<view class="btns" wx:for="{{phoneList}}" wx:key="id">
<input bindinput="writeNumber" type="number" value="{{item.phone}}" class="btn1" maxlength="11" placeholder="请输入电话号码" data-index="{{index}}"/>
<image src=http://www.yiyongtong.com/archives/"../Image/detele1.png" class="icon1" bindtap="icon" data-index="{{index}}"></image>
</view>
js:
//点击清空电话号码
icon:function(e){
var that = this;
var index = e.currentTarget.dataset.index;
var list = that.data.phoneList;
list[index].phone = '';
that.setData({
phoneList: that.data.phoneList
})
},
点击发送清空input值:
<form bindreset="cleanInput">
<input type="text" placeholder="输入新消息" bindinput="bindMessage"></input>
<button bindtap="sendMessage" formType="reset">发送 </button>
</form>
Page({
data: {
sendInfo: '',
userMessage: ''
},
bindMessage: function(e) {
this.setData({
userMessage: e.detail.value
})
},
cleanInput: function() {
var setMessage = { sendInfo: this.data.userMessage }
this.setData(setMessage)