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
|
Page({
data: {
box: [
{
name: 'box1-1',
id: 0,
class: ''
},
{
name: 'box1-2',
id: 1,
class: ''
},
{
name: 'box1-3',
id: 2,
class: ''
}
],
box2: [
{
name: 'box2-1',
id: 0,
class: ''
},
{
name: 'box2-2',
id: 1,
class: ''
},
{
name: 'box2-3',
id: 2,
class: ''
}
],
choose: -1,
choose2: -1
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
var that = this;
box2 = that.data.box2;
// console.log(box);
},
onReady: function () {
// 页面渲染完成
wx.setNavigationBarTitle({
title: '选择',
success: function (res) {
// success
}
})
},
onShow: function () {
// 页面显示
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
// 页面关闭
},
choose: function (evnet) {
console.log(event.data.msg.data.data.data.currentTarget.dataset.index);
// var index = event.data.msg.data.data.data.currentTarget.dataset.index;
var that = this;
if (event.data.msg.data.data.data.currentTarget.dataset.index == that.data.choose) {
that.setData({
choose: -1
});
} else {
that.setData({
choose: event.data.msg.data.data.data.currentTarget.dataset.index
});
}
}
})
|