-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy pathindex.ts
More file actions
109 lines (106 loc) · 2.04 KB
/
index.ts
File metadata and controls
109 lines (106 loc) · 2.04 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Page({
data: {
controlledSwipe: '',
rightBtns: [
{
text: '取消关注',
bgColor: '#CCCCCC',
color: '#fff',
width: 200,
},
{
text: '免打扰',
bgColor: '#1677FF',
color: '#fff',
width: 170,
},
{
text: '删除',
bgColor: '#FF2B00',
color: '#fff',
width: 140,
},
],
leftBtns: [
{
text: '往来记录',
bgColor: '#1677FF',
color: '#fff',
},
{
text: '设为常用',
bgColor: '#FFA91B',
color: '#fff',
},
{
text: '删除',
bgColor: '#FF2B00',
color: '#fff',
},
],
rightBtnsWithConfirm: [
{
text: '设为常用',
bgColor: '#1677FF',
color: '#fff',
},
{
text: '往来记录',
bgColor: '#FFA91B',
color: '#fff',
},
{
text: '删除',
bgColor: '#FF2B00',
color: '#fff',
confirmType: 'tap',
confirmText: '确认删除吗?',
},
],
rightBtnsWithMove: [
{
text: '设为常用',
bgColor: '#1677FF',
color: '#fff',
},
{
text: '往来记录',
bgColor: '#FFA91B',
color: '#fff',
},
{
text: '删除',
bgColor: '#FF2B00',
color: '#fff',
confirmType: 'move',
confirmText: '确认删除吗?',
},
],
swipeIndex: -1,
},
onSwipeStart() {
this.setData({ swipeIndex: '' });
},
onSwipeEnd(args1, args2) {
let e, data;
/// #if WECHAT
e = args1;
data = args1.detail;
/// #endif
/// #if ALIPAY
e = args2;
data = args1;
/// #endif
const { index } = e.target.dataset.item;
data.swiped && this.setData({ swipeIndex: index });
},
onButtonTap(data, e) {
console.log(data, e);
},
onControlSwipe(e) {
const { direction } = e.currentTarget.dataset;
this.setData({
controlledSwipe: direction,
});
},
});