infoDialog.html
2.49 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>提示信息</title>
<link rel="stylesheet" href="css/iframe/common.css">
<style>
.info-footer {
display: none;
}
</style>
</head>
<body>
<div class="info-wrap">
<div class="info-dialog info-dialog--tiny">
<div class="info-head">
<span class="info-title">提示</span>
<button class="info-headerbtn" aria-label="Close">
<i class="info-close"></i>
</button>
</div>
<div class="info-body">
<span></span>
</div>
<div class="info-footer">
<button class="info-button info-close-button">
<span>关 闭</span>
</button>
</div>
</div>
</div>
<div class="info-mask"></div>
<script>
// window.onload = function() {
var globalVm = ''; // 父级组件实例
function changeText(data) {
var str = "";
str = typeof data === "string" ? data : JSON.stringify(data);
document.getElementsByClassName('info-body')[0].childNodes[1].innerText = str;
document.getElementsByClassName('info-footer')[0].style.display = "block";
// console.log('parent window:', parent);
}
document.getElementsByClassName('info-headerbtn')[0].addEventListener('click', function(e) {
var e = e || window.event;
e.stopPropagation();
e.preventDefault();
try {
globalVm.hide();
} catch (err) {
console.log('弹窗组件关闭的异常:', err.message)
console.dir('父级 global:', parent)
globalVm = parent.infoDialogVm;
globalVm.hide();
}
// globalVm.showInfo('关闭弹窗', false);
});
document.getElementsByClassName('info-close-button')[0].addEventListener('click', function(e) {
var e = e || window.event;
e.stopPropagation();
e.preventDefault();
try {
globalVm.hide();
} catch (err) {
console.log('弹窗组件关闭的异常:', err.message)
console.dir('父级 global:', parent)
globalVm = parent.infoDialogVm;
globalVm.hide();
}
});
// }
</script>
</body>
</html>