-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
51 lines (49 loc) · 1.45 KB
/
example.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>example</title>
<!-- 引入alert.js的css和js -->
<link rel="stylesheet" href="lib/alert/alert.css" />
<script src="lib/alert/alert.js"></script>
<!-- 引入confirm.js的css和js -->
<link rel="stylesheet" href="lib/confirm/confirm.css" />
<script src="lib/confirm/confirm.js"></script>
</head>
<body>
<button onclick="onClickAlert()">showAlert</button>
<button onclick="onClickConfirm()">showConfirm</button>
<script>
// 唤起Alert弹窗
function onClickAlert() {
showAlert('欢迎登录', {
title: '提示',
okText: '确定',
onOk: function () {
// 确认按钮点击回调函数
console.log('用户点击了确定')
// 执行其他操作...
}
})
}
// 唤起Confirm弹窗
function onClickConfirm() {
showConfirm('确定要删除该文件吗?', {
title: '确认删除',
okText: '删除',
cancelText: '取消',
onOk: function () {
// 确认按钮点击回调函数
console.log('文件已删除')
// 执行其他操作...
},
onCancel: function () {
// 取消按钮点击回调函数
console.log('取消删除')
// 执行其他操作...
}
})
}
</script>
</body>
</html>