dialog.js
1023 字节
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
export default {
/**
* @export
* @param {Array} data
* @param {Object} dialog
* @param {function} fun
* @returns
* @feature 消息弹窗通用函数
*/
MessageBox (dialog, data, fun) {
return new Promise((resolve, reject) => {
dialog.showMessageBox({
type: 'info',
title: data.title,
buttons: data.buttons,
message: data.message,
noLink: data.noLink || false
}, index => {
if (index === 0) {
// eslint-disable-next-line prefer-const
let tempfun = async () => {
try {
resolve(await fun)
} catch (error) {
reject(error)
}
}
tempfun()
}
})
})
},
/**
* @export
* @param {Array} data
* @param {Object} dialog
* @returns
* @feature 错误消息弹窗
*/
ErrorMessageBox (dialog, data) {
return dialog.showErrorBox(
data.title,
data.message
)
}
}