uni-app页面多个picker ,如何解决不冲突

3 篇文章 0 订阅

 json数据:

treatFeature: [
				{ newindex: 0, key: 'strength', name: '力度', types: ['力度偏弱', '力度适中', '力度偏强'] },
				{ newindex: 0, key: 'full', name: '饱满度', types: ['脉体不充盈', '充盈适中', '脉体充盈'] },
				{ newindex: 0, key: 'thickness', name: '粗细度', types: ['偏细', '粗细适中', '偏粗'] },
				{ newindex: 0, key: 'temperature', name: '温度', types: ['体温凉', '体温正常', '体温热'] },
				{ newindex: 0, key: 'potential', name: '脉势', types: ['脉势小', '脉势大'] },
				{ newindex: 0, key: 'speed', name: '缓急', types: ['缓动', '急动'] },
				{ newindex: 0, key: 'soft', name: '刚柔', types: ['柔', '刚柔适中', '刚'] },
				{
					newindex: 0,
					key: 'Depression',
					name: '郁',
					types: ['左位郁', '左轾右轾里郁', '右轾左轩', '左轩右轩表郁', '左位郁右位郁', '左侧郁', '右位郁', '左侧郁', '左侧郁左轾']
				},
				{ newindex: 0, key: 'Stasis', name: '淤', types: ['轻度瘀', '中度瘀', '重度瘀'] },
				{ newindex: 0, key: 'water', name: '水', types: ['轻度痰', '中度痰'] },
				{ newindex: 0, key: 'wet', name: '湿', types: ['轻度湿', '中度湿', '重度湿'] },
				{ newindex: 0, key: 'sputum', name: '痰', types: ['轻度痰', '中度痰'] }
			]

页面结构代码:

<view class="uni-form-item uni-column">
				<view class="title">脉象特征</view>
				<view class="uni-list" v-for="(feature, index) in treatFeature" :key="index">
					<view class="uni-label">{{ feature.name }}</view>
					<picker mode="selector" @change="bindPickerChange" :name="feature.key" :value="feature.newindex" :data-current="index" :range="feature.types">
						<!-- <view class="iconfont icon-arrow-down icon-item"></view> -->
						<view class="uni-input">{{ feature.types[feature.newindex] }}</view>
					</picker>
				</view>
			</view>

 JavaScript逻辑代码:

bindPickerChange: function(e) {
			const curindex = e.target.dataset.current;		
			this.treatFeature[curindex].newindex = e.target.value;
			
		},

成功解决:

原文章链接

https://blog.csdn.net/yangsitong1314/article/details/77672415

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值