# Confirm 确认框
用于弹出确认框。
# 用法
# 基础用法
confirm('确认删除?');
confirm({
title: '确认删除?',
content: '确认删除 xxx',
single: true, // 单按钮
close: true, // 右上关闭按钮
small: true, // 小按钮样式
colors: {
border: 'rgb(r,g,b)',
title: 'rgb(r,g,b)',
content: 'rgb(r,g,b)',
background: 'rgb(r,g,b)',
},
cancel: { // 单按钮模式不显示
text: '取消',
color: 'rgb(r,g,b)',
bgColor: 'rgb(r,g,b)',
},
confirm: {
text: '确认',
color: 'rgb(r,g,b)',
bgColor: 'rgb(r,g,b)',
},
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 参数
{Object} config- 参数对象{String} config.title- 标题{String} config.content- 描述内容{Boolean} config.single- 单按钮{Boolean} config.close- 右上关闭按钮{Boolean} config.small- 小按钮样式{Object} config.colors- 配色{Object} config.cancel- 取消按钮配置{Object} config.confirm- 确认按钮配置
# 返回值
{Boolean}- Promise 对象- 用法:
const ok = confirm('确认删除?');
if (!ok) {
return;
}
// do something
1
2
3
4
5
2
3
4
5