微信小程序picker使用的时候可以像用select一样判断那一项被选中了吗
<view class="list">
<picker bindchange="educationChange" value="{{index}}" range="{{education}}">
<view class="picker">
<text class="picker-title" data-id="{{education[index]}}">学历</text>:{{education[index]}}
</view>
</picker>
</view>
js里面想像angular一样直接判断哪一项被选中了,求教一下,下面代码if里面那样写不行。如果不能直接判断哪一项被选中了,帮忙讲讲别的思路,谢谢了。
a.forEach(function(item){
item.option.forEach(function(item){
if(item.select){
console.log(1)
}
}
}
官方文档有明确的用法
https://mp.weixin.qq.com/debug/wxadoc/dev/component/picker.html
获取
数组数据处理
微信小程序数据操作上:合理组装数据
微信小城数据操作处理下:深度操作数据