-
Notifications
You must be signed in to change notification settings - Fork 144
/
Copy pathindex.ts
45 lines (44 loc) · 1003 Bytes
/
index.ts
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
Page({
data: {},
handleTap(e) {
const { type, text } = e.currentTarget.dataset;
/// #if ALIPAY
if (type === 'copy') {
my.setClipboard({
text,
success() {
my.showToast({ type: 'success', content: `复制成功` });
},
});
return;
}
my.alert({ content: `点击${type}` });
/// #endif
/// #if WECHAT
console.log(e);
if (type === 'copy') {
// @ts-ignore
wx.setClipboardData({
data: text,
success() {
// @ts-ignore
wx.showToast({ title: `复制成功` });
},
});
return;
}
// @ts-ignore
wx.showToast({ title: `点击${type}` });
/// #endif
},
handleDisabledTap(e) {
const { type } = e.currentTarget.dataset;
/// #if ALIPAY
my.alert({ content: `禁用状态下点击${type}` });
/// #endif
/// #if WECHAT
// @ts-ignore
wx.showToast({ title: `禁用状态下点击${type}` });
/// #endif
},
});