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
| /**
| * 轻提示
| * @param {string} content 提示内容
| * @param {object} option 配置
| */
| export function Toast (content, option = {}) {
| uni.showToast({
| title: content,
| icon: "none",
| mask: true,
| duration: 1500,
| ...option
| })
| }
|
| /**
| * Loading 提示框
| * @param {string} content 提示内容
| */
| export const Loading = {
| show: (content = "加载中") => {
| uni.showLoading({
| title: content,
| mask: true
| })
| },
| hide: () => {
| uni.hideLoading()
| }
| }
|
| /**
| * Dialog 提示框
| * @param {string} content 提示内容
| * @param {object} option 配置
| */
| export function Dialog (content, option = {}) {
| option.showCancel = false
| return new Promise((resolve, reject) => {
| uni.showModal({
| title: "温馨提示",
| content,
| showCancel: false,
| confirmColor: "#1677FF",
| success (res) {
| if (res.confirm) resolve(res)
| },
| fail () {
| reject(new Error("Alert 调用失败 !"))
| },
| ...option
| })
| })
| }
|
|