3***@qq.com
3***@qq.com
  • 发布:2019-03-21 11:44
  • 更新:2019-03-21 11:44
  • 阅读:3688

uni 文本框循环取值

分类:uni-app

//按钮方法
formSubmit: function(e, key) {
var keys = key * 3;//key是定位所在位置,比如遍历出来的第一行是0,第二行是1,我这边乘以3是因为我一行有3个文本框。
var inpArr = document.getElementsByTagName("input");//定位页面input ,所以这里如果页面有其他不是文本框的input 那要注意了。。。
const vip = inpArr[keys + 2].value;
const svip = inpArr[keys + 1].value;
const ssvip = inpArr[keys].value;
}

//页面代码
<view class="uni-card" v-for="(value, key) in list2" :key="key">
<view class="uni-flex uni-row am-margin-bottom-sm product-list-name">
<view style="flex: 1; line-height: 38upx;">{{ value.proName }}&nbsp;【{{value.proSize}}】</view>
<view class="am-text-right" style="width: 140upx;">
<uni-badge text="待调价" type="danger"></uni-badge>
</view>
</view>
<view class="uni-flex uni-row product-list-right">
<view class="product-list-small">成本价</view>
<view class="product-list-small">SVIP价</view>
<view class="product-list-small">VIP价</view>
<view class="product-list-small">会员价</view>
</view>
<view class="uni-flex uni-row product-list-right">
<view class="product-list-money" style="border: 2upx solid #f1f1f1; font-size: 32upx; color: #FF5101; line-height: 70upx; font-weight: bold;">{{ value.proCbj }}</view>
<view class="product-list-money">
<input type="number" :value="value.proSSVip" name='ssvip1' />
</view>
<view class="product-list-money">
<input type="number" :value="value.proSVip" name='svip1' />
</view>
<view class="product-list-money">
<input type="number" :value="value.proVip" name='vip1' />
</view>
</view>
<view class="product-list-foot-font">
<text class="iconfont icon-yangshengqi" style="font-size: 20upx; color: #aaa; margin-right: 4upx;"></text>
<text style="color: #999; font-size: 26upx;">19-01-12</text>从<text>15.50</text>调为<text>{{ value.money }}</text>,差额<text>{{ value.rate }}</text>
</view>
<view class="am-text-center finance-list-btn">
<button type="warn" @tap="formSubmit(value.proID,key)">确认调价</button>
</view>
</view>

0 关注 分享

要回复文章请先登录注册