-
Notifications
You must be signed in to change notification settings - Fork 0
/
testLayUI.html
144 lines (131 loc) · 4.89 KB
/
testLayUI.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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Multi-column Layout</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/layui.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.global.min.js"></script>
<script src="https://unpkg.com/popper.js/dist/umd/popper.min.js"></script>
<script src="https://unpkg.com/tooltip.js/dist/umd/tooltip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/layui.min.js"></script>
<style>
html, body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
font-size: 14px;
/*overflow-y: hidden;*/
overflow-x: hidden;
}
#calendar {
max-width: 1100px;
margin: 40px auto;
width:80% ;
}
</style>
</head>
<body>
<div class="layui-btn-container">
<button type="button" class="layui-btn layui-btn-primary" lay-on="alert">Alert</button>
<button type="button" class="layui-btn layui-btn-primary" lay-on="confirm">Confirm</button>
<button type="button" class="layui-btn layui-btn-primary" lay-on="msg">Msg</button>
<button type="button" class="layui-btn layui-btn-primary" lay-on="page">Page</button>
<button type="button" class="layui-btn layui-btn-primary" lay-on="iframe">Iframe</button>
<button type="button" class="layui-btn layui-btn-primary" lay-on="load">Load</button>
<button type="button" class="layui-btn layui-btn-primary" lay-on="tips">Tips</button>
<button type="button" class="layui-btn layui-btn-primary" lay-on="prompt">Prompt</button>
<button type="button" class="layui-btn layui-btn-primary" lay-on="photots">Photots</button>
<script>
layui.use(function(){
var layer = layui.layer;
var util = layui.util;
// 批量事件
util.on('lay-on', {
alert: function(){
layer.alert('对话框内容');
},
confirm: function(){
layer.confirm('一个询问框的示例?', {
btn: ['确定', '关闭'] //按钮
}, function(){
layer.msg('第一个回调', {icon: 1});
}, function(){
layer.msg('第二个回调', {
time: 20000, // 20s 后自动关闭
btn: ['明白了', '知道了']
});
});
},
msg: function(){
layer.msg('一段提示信息');
},
page: function(){
// 页面层
layer.open({
type: 1,
area: ['420px', '240px'], // 宽高
content: '<div style="padding: 11px;">任意 HTML 内容</div>'
});
},
iframe: function(){
// iframe 层
layer.open({
type: 2,
title: 'iframe test',
shadeClose: true,
shade: 0.8,
area: ['380px', '80%'],
content: '/layer/test/1.html' // iframe 的 url
});
},
load: function(){
var index = layer.load(0, {shade: false});
setTimeout(function(){
layer.close(index); // 关闭 loading
}, 5000);
},
tips: function(){
layer.tips('一个 tips 层', this, {
tips: 1
});
},
prompt: function(){
layer.prompt({title: '密令输入框', formType: 1}, function(pass, index){
layer.close(index);
layer.prompt({title: '文本输入框', formType: 2}, function(text, index){
layer.close(index);
alert('您输入的密令:'+ pass +';文本:'+ text);
});
});
},
photots: function(){
layer.photos({
photos: {
"title": "Photos Demo",
"start": 0,
"data": [
{
"alt": "layer",
"pid": 1,
"src": "https://unpkg.com/[email protected]/demo/layer.png",
},
{
"alt": "壁纸",
"pid": 3,
"src": "https://unpkg.com/[email protected]/demo/000.jpg",
},
{
"alt": "浩瀚宇宙",
"pid": 5,
"src": "https://unpkg.com/[email protected]/demo/outer-space.jpg",
}
]
}
});
}
});
});
</script>
</body>
</html>