微信小程序实现多列选择器

网友投稿 414 2023-11-13

本文实例为大家分享了微信小程序实现多列选择器的具体代码,供大家参考,具体内容如下

?
1
2
3
4
5
6
7
<picker class="picks" mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange"
value="{{multiIndex}}" range="{{multiArray}}">
<view class="picker {{seleNull == 0 ?:cur}}">
{{seleNull == 0 ? date:请选择日期}}
</view>
<image class="icon" src="../../images/down.png"></image>
</picker>
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
data: {
seleNull: null,
multiIndex: [0, 0, 0],
multiArray: [],
month: ,
year:
},
onLoad: function (options) {
var that = this
that.return_date()
},
// 获取历史记录日期
return_date() {
var that = this
var datas = {
type: that.data.tag,
user_id: app.globalData.userId,
month: that.data.month,
year: that.data.year
}
wx.request({
url: app.globalData.urlSrc + hardware/return_date,
data: datas,
method: "POST",
header: {
content-type: app.globalData.head
},
success(res) {
console.log(获取历史日期, res.data)
var code = res.data.status
if (code == 200) {
var multiArray = res.data.data
that.setData({
multiArray: multiArray
})
}
}
})
},
// 多例选择
bindMultiPickerChange: function (e) {
var multiIndex = e.detail.value
var multiArray = this.data.multiArray
this.setData({
multiIndex: multiIndex,
seleNull: 0,
date: multiArray[0][multiIndex[0]] + - + multiArray[1][multiIndex[1]] + - + multiArray[2][multiIndex[2]]
})
this.getmeasInfos()
},
// 控制单列
bindMultiPickerColumnChange: function (e) {
var that = this
var data = {
multiArray: that.data.multiArray,
multiIndex: that.data.multiIndex,
idx:e.detail.value,
column : e.detail.column
}
// data.multiIndex[e.detail.column] = e.detail.value;
if(data.column == 0){
that.setData({
year: data.multiArray[0][data.idx],
month:
})
data.multiIndex[1] = 0;
data.multiIndex[2] = 0;
that.return_date()
}else  if(data.column == 1){
that.setData({
month: data.multiArray[1][data.idx]
})
data.multiIndex[2] = 0;
that.return_date()
}
},

微信小程序实现多列选择器

以上就是本文的全部内容,希望

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:服装行业是否有必要开发手机APP?
下一篇:双减时代下,教育APP前景如何?
相关文章

 发表评论

暂时没有评论,来抢沙发吧~